So i have a mysql data-base that holds the data that i need, consists of the id, location, date, time and price.
I have a script that will generate a table for me with all the correct cells and headers.
now i am a bit stuck, i can pulll the data out the mysql data base, but i cant get them to display correctly.
if this sums it up, for every id it needs to make a new row and display the correct information from that id,
here is what i got:
[php]
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect server “);
mysql_select_db(”$db_name”)or die(“cannot select DB”);
$result = mysql_query(“SELECT * FROM $tbl_name”);
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$tbl = new HTML_Table(null, ‘display’, 1, 0, 4);
$tbl->addRow();
$tbl->addCell(‘Location’, ‘first’, ‘header’);
$tbl->addCell(‘Price’, null, ‘header’);
$tbl->addCell(‘Date’, null, ‘header’);
$tbl->addCell(‘Time’, null, ‘header’);
foreach($row as $newdata) {
list($row["location"], $row["date"], $row["time"], $row["price"] ) = $newdata;
$tbl->addRow();
$tbl->addCell($row["location"]);
$tbl->addCell($row["date"]);
$tbl->addCell($row["time"]);
$tbl->addCell($row["price"]);
}
echo $tbl->display();
}
mysql_free_result($result);
[/php]
now if i show you in html how that is meant to display incase you dont understand me,
[code]
LOCATION CELL | DATE CELL | TIME CELL | PRICE CELL |
Obviously replace the text with the data that is in the mysql data-base.
I thought $row would work but all i get is a load of messy no no.
Help very much appriciated!