Forum Moderators: coopster

Message Too Old, No Replies

Help putting data into html table

Want to put specific query results into specific cells

         

Nevgar

5:34 am on Jun 1, 2007 (gmt 0)

10+ Year Member



I am trying to put results from a query into specific cells in a table.
To give you an idea what the results are from the query, go to:
<snip>
{pick a cruiseline and then pick a ship, or search for a ship name - use "Freedom" if you don't know any other}

To see a sample of what I want the results to look like, go to:
<snip>

As you can see, I can get the results for a ship.
I can present it in a table with 2 columns, the key being in col 1 and the value in col 2.

I would really like to have it more like the sample, if at all possible.

As I am a real newbie at php and mysql, any help would be appreciated.

Thanks
Nevgar - Inuvik, NT, Canada

[edited by: dreamcatcher at 7:12 am (utc) on June 1, 2007]
[edit reason] no urls as per T.O.S [webmasterworld.com].Thanks [/edit]

dreamcatcher

7:17 am on Jun 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Nevgar,

Sorry, we don`t allow personal urls. You might want to revise your thread and give us some more information.

dc

coopster

9:03 pm on Jun 1, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



To display the contents in a table all you need to do is loop through the result set and populate the tables cells.
$results = mysql_query($sql); 
while ($row = mysql_fetch_array($results)) {
print '<tr>';
print '<td>' . htmlentities($row['col1'] . '</td>';
print '<td>' . htmlentities($row['col2'] . '</td>';
print '</tr>';
}

And welcome to WebmasterWorld, Nevgar.