Helpful Information
Home
Categories
Contact us
Category: PHP Development
Output into table
Hi,
I'd like to output some query results in a table, each result in it's own column and row. Here's an example --
***********************************
IF ($result){
echo "<center><table><tr><td>";
while ($r = mysql_fetch_array($result)) {
$number = $r["stock_number"];
$description = $r["item_description"];
echo "$number<br></td>";
echo "<td>$description<br>";
}
echo "</td></tr></table>";
} else
{
echo "No data.";
*********************************
Except it doesn't work correctly. What is the proper way to accomplish this?
Thanks
Hello,
please try this out :
You've got to make once a table and you got to embed for each productnr. and description a own row and column.
I hope this will help you out !
***********************
echo "<center><table>";
IF ($result)
{
while ($r = mysql_fetch_array($result))
{
$number = $r["stock_number"];
$description = $r["item_description"];
echo "<tr><td>$number<br></td>";
echo "<td>$description</td></tr>";
}
echo "</table>";
} else
{
echo "No data.";
*********************************
privacy (GDPR)