Dear I have following codes
<?php
// Connection variables
$host="localhost";
$username="root";
$password="";
$db_name="asia";
// Connect to database
$con=mysqli_connect("$host", "$username", "$password");
// Connect result
if(!$con){
die('Error Connecting to Database: ' . mysqli_error());
//die '<script type="text/javascript">alert("Error Connecting to Database"). mysqli_error($con);</script>';
}
else
{
echo '<script type="text/javascript">alert("Connected"). mysqli_error($con);</script>';
}
// Database Selection
$sel =mysqli_select_db($con,"$db_name");
// Database Selection result
if(!$sel){
die('Error selecting Database: ' . mysqli_error());
}
else
{
//echo "Database Selected" . mysqli_error($con);
echo '<script type="text/javascript">alert("Database Selected"). mysqli_error($con);</script>';
}
$result = mysql_query("select sno,packing,weight from ghee");
if(!$result){
echo 'select query error or data not found';
}
else
{
echo 'data found';
echo "<table border='1' style='border-collapse: collapse'>";
echo "<th>SNo</th><th>Name</th><th>Weight</th>";
while ($row = mysql_fetch_array($result))
{
echo"<tr><td>".$row['sno']."</td><td>".$row['packing']."</td><td>".$row['weight']."</td></tr><br>";
echo "</table><br>";
}
}
mysqli_close($con);
?>
on this line number 35
echo 'select query error or data not found';
it says:select query error or data not found
connection with mysql is ok
and
Database is selected properly
but why I get above error message
Here is screen shot of database
[IMG]http://i41.tinypic.com/2w5lx8y.jpg[/IMG]
Please help me to get rid of error message