hakaii wrote:Hi - I'm stuck with this problem and would be grateful for some pointers:
I would like to create a dynamic HTML table populated by data from a MySQL table.
See the MySQL functions section of the manual. General outline: specify the db host, username, and password; call the connection (mysql_connect), construct the query string, and then run it.
Two of the columns in the MySQL table are labeled “country” and “category”.
See, for example, [man]mysql_field_name/man --- assuming you name your fields something meaningful, you can use this function to read the field headers for the HTML table directly from the db.
Currently there are 12 different countries and 5 different categories. I would like to construct the HTML table so that its columns correspond to the 5 categories and its rows to the 12 countries.
See above. Also, [man]mysql_fetch_array/man, [man]while/man, etc.
Then I would like to populate the fields in the table with the number of rows in the MySQL table that contain a given combination of “country” and “category”.
All in the query. "Select from table_name where country = 'foo' and category LIKE 'bar'" ...
Show us some code; I'm sure somebody will be willing to give some aid when you hit the inevitable snag ...