Possible Duplicate:
PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given
I am trying to insert data from submitted form into database. The data is being successfully inserted into the DB but I keep getting this error message:
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
And here's the code:
function senddata () {
$con = mysql_connect("localhost","XXX","XXX");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user", $con);
$sql="INSERT INTO Employment (CollegeMajor) VALUE('$_POST[collegemajor]')";
$result=mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($result);
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
}
The error message is referring to this line:
$row = mysql_fetch_assoc($result);