I uploaded a script for displaying information I've entered into my mysql database, and I'm getting the following error: Unknown column 'title' in 'field list'
I've double, triple checked the script to make sure that title exists and is spelled correctly. Does anyone know why this would happen?
Here's my script:
<?
$host="localhost";
$user="username";
$password="password";
$dbname="dbname";
$dbtable="news";
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("dbname");
?>
<html>
<head>
</head>
<body>
<?
$sql = "select title, news, author, date;";
$result = mysql_query($sql, $dbh) or die( mysql_error() );
$title= mysql_result($result, 0, "title");
$news= mysql_result($result, 0, "news");
$author= mysql_result($result, 0, "author");
$date= mysql_result($result, 0, "date");
?>
<table width="100%">
<tr>
<td colspan="8">Basic Informantion</td>
</tr>
<tr>
<td><p>Name:</p></td>
<td><p><? print "$title" ?></p></td>
<td><p>Weight:</p></td>
<td><p><? print "$news" ?></p></td>
<td><p>Day:</p></td>
<td><p><? print "$author" ?></p></td>
<td><p>Date:</p></td>
<td><p><? print "$day" ?></p></td>
</tr>
</table>
</body>
</html>