RE: [PHP-DB] formatting w/ table
| From: | Rick Emery | Date: | Fri, 15 Feb 2002 20:42:11 +0000 |
| Subject: | RE: [PHP-DB] formatting w/ table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16985@lists.php.net to get a copy of this message | ||
Further, I recommend replacing your echos with the following:
echo "<tr><td width=\"30%\"><B>Type Of Car:
"</B></td><td>".
$myrow['car_type']."</td></tr>\n";
echo "<tr><td width=\"30%\"><B>Model Of Car:
</B></td><td>".
$myrow['car_model']."</td></tr>\n";
echo "<tr><td width=\"30%\"><B>Year Of Car:
</B></td><td>".
$myrow['car_year']."</td></tr>\n";
echo "<tr><td width=\"30%\"><B>Price Of Car:
</B></td><td>$".
$myrow['car_price'."</td></tr>\n";
echo "<tr><td width=\"30%\"><B>VIN Of Car:
</B></td><td>".
$myrow['car_vin']."</td></tr>";
echo "<tr><td colspan=\"2\"><hr
color=\"333333\"></td></tr>";
}
echo "</table>\n";
?>
-----Original Message-----
From: jas [mailto:jlgerfen@hotmail.com]
Sent: Friday, February 15, 2002 2:35 AM
To: php-db@lists.php.net
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?
<?php
require 'scripts/db.php';
$result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not
execute query, please try again later");
echo "<table border=\"0\" class=\"newhead\"
width=\"100%\"><tr><td
align=\"center\" colspan=\"2\"><B>Current Inventory</B><hr
color=\"333333\"></td></tr>";
$count = -1;
while ($myrow = mysql_fetch_row($result)) {
$count ++;
echo "<tr><td width=\"30%\"><B>Type Of Car:
</B></td><td>";
printf(mysql_result($result,$count,"car_type"));
echo "</td></tr>\n";
echo "<tr><td width=\"30%\"><B>Model Of Car:
</B></td><td>";
printf(mysql_result($result,$count,"car_model"));
echo "</td></tr>\n";
echo "<tr><td width=\"30%\"><B>Year Of Car:
</B></td><td>";
printf(mysql_result($result,$count,"car_year"));
echo "</td></tr>\n";
echo "<tr><td width=\"30%\"><B>Price Of Car:
</B></td><td>$";
printf(mysql_result($result,$count,"car_price"));
echo "</td></tr>\n";
echo "<tr><td width=\"30%\"><B>VIN Of Car:
</B></td><td>";
printf(mysql_result($result,$count,"car_vin"));
echo "</td></tr><tr><td colspan=\"2\"><hr
color=\"333333\"></td></tr></table>\n";
}
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php