[RESOLVED] php5 insert statement not working, whats the error mean
Am trying to get an insert statement working,
Code:
$sql = "insert into sbyd_member_group (mcid, name, desc, members) values ('$groupid', '$title', '$newdescription', 0)";
$result = mysql_query($sql ,$db);
die("$result = '" . $result . "'");
$result has null in it, what exactly does that mean? Clearly not working as am not seeing a new row being added :ehh:
Re: php5 insert statement not working, whats the error mean
It means the query failed for whatever reason.
Use the mysql_error function to see specifically why.
PHP Code:
$result = mysql_query($sql, $db);
if (!is_resource($result))
{
die(mysql_error());
}
Replace die() with some other logic in a production environment, of course.
Re: php5 insert statement not working, whats the error mean
Thanks penagate :)
It didn't like the field name "desc" so changed to description and it's working like a brought thing :wave:
Re: [RESOLVED] php5 insert statement not working, whats the error mean
Yes, DESC is a keyword (descending order).