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);
?>
Edited by shadowblad3rz
Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.