Re: [PHP-DB] formating w/ table
Jas color=\"33\">\n"; } ?> The is in the loop. Place it outside & you'll be OK. Miles Thompson At 01:35 AM 2/15/2002 -0700, jas wrote: >I am having a little problem formating data retrieved from a database into >table cells... So far after connecting and querying the database table the >data is put into table cells, however after the first entry is displayed in >the table all the other entries loose the formating, HELP? >require 'scripts/db.php'; >$result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not >execute query, please try again later"); >echo "align=\"center\" colspan=\"2\">Current Inventorycolor=\"33\">"; >$count = -1; >while ($myrow = mysql_fetch_row($result)) { >$count ++; >echo "Type Of Car: "; >printf(mysql_result($result,$count,"car_type")); >echo "\n"; >echo "Model Of Car: "; >printf(mysql_result($result,$count,"car_model")); >echo "\n"; >echo "Year Of Car: "; >printf(mysql_result($result,$count,"car_year")); >echo "\n"; >echo "Price Of Car: $"; >printf(mysql_result($result,$count,"car_price")); >echo "\n"; >echo "VIN Of Car: "; >printf(mysql_result($result,$count,"car_vin")); >echo "color=\"33\">\n"; >} >?> > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] formating w/ table
Your is inside your loop. So it is executed once to terminate the table. After that, the browser just sees the rest as straight text. -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 2:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] formating w/ table I am having a little problem formating data retrieved from a database into table cells... So far after connecting and querying the database table the data is put into table cells, however after the first entry is displayed in the table all the other entries loose the formating, HELP? Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "\n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] formating w/ table
I am having a little problem formating data retrieved from a database into table cells... So far after connecting and querying the database table the data is put into table cells, however after the first entry is displayed in the table all the other entries loose the formating, HELP? Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "\n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php