Can anyone see where the error is in this....
I know its something to do witht the query but i can see where ive went wrong... when i test it gives me back my error 'database error'
<?php
$host = "localhost";
$user = "xxx";
$password = "xxx";
$dbname = "popcop_db";
$tablename = "ca";
/* Fetch current time from server */
$currentTime = time();
/* Build SQL query to insert our information into table */
$db_query = "INSERT INTO $tablename (name, comments, entrydate) ";
$db_query .= "VALUES('$name', '$comments', $currentTime)";
/* Execute query */
$db_result = mysql_query($db_query);
/* If there was an error executing query... */
if (!$db_result) {
/* Return error information to Flash and quit! */
print "database error";
exit;
} else {
$query = "SELECT name, comments FROM $tablename";
$result = mysql_query($query);
$numItems = mysql_num_rows($result);
?>
<html>
<head>
<title>news</title>
</head>
<body bgcolor="#0099CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="26" height="115" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><img src="top.gif" width="300" height="115"></td>
</tr>
</table>
<?
print"<table width='300' height='49' border='0' cellpadding='0' cellspacing='0'>";
while(list($name, $comment) = mysql_fetch_row($result)) {
print"<tr>
<td colspan='3'><img src='spacer.gif' width='100' height='5'></td>
</tr>
<tr bgcolor='#1DB7EB'>
<td width='10' rowspan='2'></td>
<td width='274' height='20' valign='middle' class='unnamed1'><img src='name.gif' width='40' height='8'>$name</td>
<td width='16' rowspan='2'></td>
</tr>
<tr>
<td height='20' valign='middle' bgcolor='#1DB7EB' class='unnamed1'><img src='said.gif' width='65' height='8'>$comments</td>
</tr>";
}
}
print"</table>";
?>