Jump to content

MYSQL Display Table on Code


shadowblad3rz

Recommended Posts

Hey guys i have the code below for mySQL database, but the thing is it won't display on my browser am i doing anything wrong ? The thing im trying to do is display my table records on the browser which it wont do :(

<?php
$con = mysql_connect('localhost','username','password');
if (!$con)
{
die("Could Not Connect: " . mysql_error());
}

mysql_select_db("database", $con);
$sql = "SELECT * FROM Order_Information";
$myData = mysql_query($sql, $con);
echo "<table border=1>
<tr>
<th>Order ID</th>
<th>Order Items</th>
<th>Order Quantity</th>
</tr>";
while($record= mysql_fetch_array($myData))
{
echo "<tr>";
echo "<td>" . $record['Order_ID'] . "</td>";
echo "<td>" . $record['Order_Items'] . "</td">;
echo "<td>" . $record['Order_Quantity'] . "</td"> ;
echo "</tr>";
}
echo "</table>";

mysql_close($con);
?>
Link to comment
https://forums.phpfreaks.com/topic/279473-mysql-display-table-on-code/
Share on other sites

you have a couple of " and > reversed on lines 21 and 22, resulting in fatal php parse/syntax error(s) and since your code never runs for fatal parse/syntax errors, there's no output.

 

you need to have php's error_reporting set to E_ALL and display_errors set to ON in your php.ini so that php will report and display all the errors it detects.

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.