Hi all,
I need a little help writing the php code for a page which will display a table with as many columns as how many records found in a MySql database table and as many rows as how many rows are found on a different MYSql table. The two tables are related so lets say if I have a fruit record in first table the apples and bananas will display under this record. So basically the first row will extract the captions from first MySql table and following rows will display the actual records from second MySql table.
Thanks in advance for your help.
Julian
PHP displaying MYSql data formated in table
Moderator: General Moderators
- mecha_godzilla
- Forum Contributor
- Posts: 375
- Joined: Wed Apr 14, 2010 4:45 pm
- Location: UK
Re: PHP displaying MYSql data formated in table
Trying to retrieve the column names is a bit more involved than a normal query, so I suggest you look at the following address for some example code as a starting point:
http://uk2.php.net/manual/en/function.m ... .php#25664
I tried this and it seemed to work - it basically generates a table view exactly as it looks when you 'browse' a table in phpMyAdmin. This doesn't quite solve you're problem but it shouldn't take too much effort to extrapolate what this script does to your 'two table' model.
If you need any further help just say so.
HTH,
Mecha Godzilla
http://uk2.php.net/manual/en/function.m ... .php#25664
I tried this and it seemed to work - it basically generates a table view exactly as it looks when you 'browse' a table in phpMyAdmin. This doesn't quite solve you're problem but it shouldn't take too much effort to extrapolate what this script does to your 'two table' model.
If you need any further help just say so.
HTH,
Mecha Godzilla