So, I have a table, that resulted from a MySQL query. this query is an inner join of two tables from a MySQL DB, in which one provides a product name, and the other a price table in HTML (which can have 2 or more columns, and variable number of rows).
Mysql query:
SELECT catalog_product_entity_varchar.value as `name`, catalog_product_entity_text.value as `html_table` from catalog_product_entity_varchar INNER JOIN catalog_product_entity_text on catalog_product_entity_varchar.entity_id=catalog_product_entity_text.entity_id AND catalog_product_entity_text.attribute_id=171 AND catalog_product_entity_varchar.attribute_id=71"
To output the table, I used the following:
echo '<table border="1">';
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo
'<th>'.$row["name"]. '</th><tr><td>'. $row["html_table"].'</td></tr>';
}
Now, I need to change the content in the "html_table" part, specifically, from the second row (first is text) of the second column (first is text also).
I've looked into several parsers like simplehtmldom or DOM class of php, but I still can't grasp how to just change those specific rows/columns.
Any suggestions would be greatly appreciated!
You need to do 2 steps :
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments