what's the error mysql

Discussion in 'PHP' started by googlehelper, Feb 14, 2009.

  1. #1
    INSER INTO reg ( fname, lname, email, pwd, pv, ev, dob) VALUES ('hi','hello','hi@hello.com',md5(google),'0','1','19471010');

    pv and ev are int rest are varchar
     
    googlehelper, Feb 14, 2009 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    INSERT not INSER for starters or was that just a typo here?

    and quotes around the statemnet:

    "INSERT INTO reg ( fname, lname, email, pwd, pv, ev, dob) VALUES ('hi','hello','hi@hello.com',md5(google),'0','1','19471010')" ;
     
    Colbyt, Feb 14, 2009 IP
  3. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #3
    1. Remove space before fname
    2. Check if there is enough place for data to come in ( for example, 5 char varchar field will not be able to handle 10 chars ).
    3. Add md5(google) as a variable ( $md = md5(google) )
    
    $md = md5(google);
    $query = "INSER INTO reg (fname, lname, email, pwd, pv, ev, dob) VALUES ('hi','hello','hi@hello.com','$md','0','1','19471010')";
    mysql_query($query);
    PHP:
     
    ActiveFrost, Feb 14, 2009 IP
  4. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Try this.
    
    $query = "INSERT INTO reg ( fname, lname, email, pwd, pv, ev, dob) VALUES ('hi','hello','hi@hello.com',md5('google'),'0','1','19471010')";
    
    // run it
    $runquery = mysql_query($query);
    
    
    PHP:
    I changed :
    - INSER INTO to INSERT INTO
    - md5(google) to md5('google')
    - Assigned the query into $query
     
    ads2help, Feb 14, 2009 IP
  5. googlehelper

    googlehelper Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks opps insert is typo error so is the space before fname and this is not a mistake in the original script

    i will surely take 'google' into account and reply
     
    googlehelper, Feb 17, 2009 IP