|
-
Feb 2nd, 2008, 09:34 PM
#1
Thread Starter
Hyperactive Member
[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
-
Feb 2nd, 2008, 09:57 PM
#2
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.
-
Feb 2nd, 2008, 10:19 PM
#3
Thread Starter
Hyperactive Member
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
-
Feb 3rd, 2008, 02:00 AM
#4
Re: [RESOLVED] php5 insert statement not working, whats the error mean
Yes, DESC is a keyword (descending order).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|