Change value of html table column, generated in MySQL query, using php

Dash

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!

Naveed Ramzan

You need to do 2 steps :

  • Add JQuery code which will send request to a PHP file and get response. After getting it will be loading that JSON and show in table->tbody section.
  • PHP file will receive request and then connect with MySQLi and fetch results as per your requirements and return JSON.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to change mysql column from html table with php scripting

From Dev

Display any given MySQL SELECT query as a HTML table using PHP

From Dev

Display any given MySQL SELECT query as a HTML table using PHP

From Dev

Adding elements from a MYSQL query to a HTML Table using PHP

From Dev

Count value issue in HTML Table using PHP MYSQL

From Dev

PHP/MySQL Can't print column generated by query

From Dev

mysql select query php based on column value

From Dev

Icon after each value for specific column generated in PHP with MySQL

From Dev

Check two table value in php mysql query

From Dev

MySQL query displays no results in HTML table with PHP

From Dev

HTML table and external Php file that change value

From Dev

mySQL using value of a table as a field to get query

From Dev

mysql query to insert the value of a column with respect to another column in same table

From Dev

Using a PHP generated webform and mySQL to update multiple rows in a table

From Dev

Styling an html table generated with php

From Dev

Insert value to DB using MYSQL query in PHP

From Dev

CSV to MySQL using PHP -- change value

From Dev

How to get the maximum value of a column of a MySQL table, in PHP land, using the WordPress API

From Dev

How to get the maximum value of a column of a MySQL table, in PHP land, using the WordPress API

From Dev

Change Mysql column Value

From Dev

Change Mysql column Value

From Dev

Q: Update value in mysql table using PHP

From Dev

Mysql Query - Get row value based on column name in a different table

From Dev

add column value of oracle database table via php query

From Dev

PHP & MYSQL - Query DB Table to confirm field is in a Column

From Dev

PHP & MYSQL - Query DB Table to confirm field is in a Column

From Dev

how to change (Update) column name in table using MySQL workbench?

From Dev

how to insert a set of rows and xml generated column by using CTE into a table in single query

From Dev

php mysql query getting only first value in column

Related Related

  1. 1

    How to change mysql column from html table with php scripting

  2. 2

    Display any given MySQL SELECT query as a HTML table using PHP

  3. 3

    Display any given MySQL SELECT query as a HTML table using PHP

  4. 4

    Adding elements from a MYSQL query to a HTML Table using PHP

  5. 5

    Count value issue in HTML Table using PHP MYSQL

  6. 6

    PHP/MySQL Can't print column generated by query

  7. 7

    mysql select query php based on column value

  8. 8

    Icon after each value for specific column generated in PHP with MySQL

  9. 9

    Check two table value in php mysql query

  10. 10

    MySQL query displays no results in HTML table with PHP

  11. 11

    HTML table and external Php file that change value

  12. 12

    mySQL using value of a table as a field to get query

  13. 13

    mysql query to insert the value of a column with respect to another column in same table

  14. 14

    Using a PHP generated webform and mySQL to update multiple rows in a table

  15. 15

    Styling an html table generated with php

  16. 16

    Insert value to DB using MYSQL query in PHP

  17. 17

    CSV to MySQL using PHP -- change value

  18. 18

    How to get the maximum value of a column of a MySQL table, in PHP land, using the WordPress API

  19. 19

    How to get the maximum value of a column of a MySQL table, in PHP land, using the WordPress API

  20. 20

    Change Mysql column Value

  21. 21

    Change Mysql column Value

  22. 22

    Q: Update value in mysql table using PHP

  23. 23

    Mysql Query - Get row value based on column name in a different table

  24. 24

    add column value of oracle database table via php query

  25. 25

    PHP & MYSQL - Query DB Table to confirm field is in a Column

  26. 26

    PHP & MYSQL - Query DB Table to confirm field is in a Column

  27. 27

    how to change (Update) column name in table using MySQL workbench?

  28. 28

    how to insert a set of rows and xml generated column by using CTE into a table in single query

  29. 29

    php mysql query getting only first value in column

HotTag

Archive