SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Am I blind?

  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Am I blind?

    k..im going insane..

    using a simple insert statement..nuthing fancy
    PHP Code:

    $result 
    mysql_query("INSERT INTO users VALUES ($uid, '$name', '$phone', '$address', '$email', '$website')")
                or die(
    "line 15, data was not inserted ".mysql_error()); 
    looks fine..right??

    it produces this error

    PHP Code:
    You have an error in your SQL syntax near ')' at line 1 
    Am i not seeing the error?? all the quotes are there... al opening brackets have closed onces..commas are in right place...
    IM GOIN INSANE
    AAAAHHHHHHHHHHH....


    thanx

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it possible one of your variables has a un escaped character in it. Like a quote. I would suggest printing the sql statement to the screen and see what it turns up.

    PHP Code:
    $sql "INSERT INTO users VALUES ($uid, '$name', '$phone', '$address', '$email', '$website')";
    print 
    $sql;
    $result mysql_query($sql)
                or die(
    "line 15, data was not inserted ".mysql_error()); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    already tried that
    all the variables are be putting through and dont have any "special" characters

  4. #4
    SitePoint Member
    Join Date
    Apr 2001
    Location
    San Diego, CA
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shouldn't this:
    PHP Code:
    VALUES ($uid'$name' 
    be like this:

    PHP Code:
    VALUES ('$uid''$name' 
    All I can see is that you forgot the ' and ' around $uid
    Mike Henderson
    NFSGarage

  5. #5
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remove the die section and see if it works..

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mike if $uid only contains numbers then you don't need to use quotes around it.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •