Results 1 to 4 of 4

Thread: [RESOLVED] php5 insert statement not working, whats the error mean

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Resolved [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

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    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

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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
  •  



Click Here to Expand Forum to Full Width