<?php
$host = 'localhost';
$dbusername ='root';
$dbpassword ='';
$database ='mp19';
$link =mysql_connect('localhost', 'root','12345678');
$db_selected = mysql_select_db('mp19', $link);
if (!$link)
{exit("Connection Failed: " . $link);}
$sql="(SELECT * FROM 3-33)";
$result=mysql_query($sql, $link);
if (!$result)
{exit("Error in SQL");}
echo "<table><tr>";
echo "<th>Date</th>";
while ($row=mysql_fetch_assoc($result))
{
var_dump($row);
echo "<td>$row['date']</td></tr>";
}
mysql_close($link);
?>
The connection is successful but the data doesn't get fetched from phpmysql and neither does it print in a table. Why is this so?
Originally asked by: Chandni on Stack Overflow


Answers