Jump to content

[SOLVED] multiple of same field


brem13

Recommended Posts

ive got a menu in a mysql database and there are different things like salads, sandwiches, etc. in the database i have the fields contain the entree, price and the type(salad, sandwich, etc). i want the type(Salad) to be a header for all 5 salads but it shows up for every salad, see screenie below. basically, i want it to show 'salads' as a header above all the salads. how can i get it to not show salads for the other 4 salads.

my code is

$result = mysql_db_query('btscrows_menu', "select * from lunch") or die (mysql_error());
	while($qry = mysql_fetch_array($result)){
		$entree = $qry['entree'];
		$desc = $qry['desc'];
		$price = $qry['price'];
		$type = $qry['type'];

			echo '<tr>';
				echo '<td align=center colspan=5><font face=tahoma size=3><i><b>'.$type.'</b></i></font></td>';
			echo '</tr>';

			echo '<tr>';
				echo '<td width=100px></td>';
				echo '<td width=200px><font face=tahoma size=2><strong>'.$entree.'</strong></font></td>';
				echo '<td width=300px><font face=tahoma size=2>'.$desc.'</font></td>';
				echo '<td width=100px><font face=tahoma size=2>$'.$price.'</font></td>';
				echo '<td width=35px></td>';
			echo '</tr>';

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/172436-solved-multiple-of-same-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.