SQL syntax error

Discussion in 'PHP' started by MrPJH, Dec 5, 2011.

  1. #1
    Where and what is the error ?

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select column from this_table where email=example@example.com limit 0, 10' at line 1

    
    $hid="select column from this_table where email=".$_SESSION['email'];
    $hid2="select * from that_table where status1=1 and status2=1 and status1<>3 and id not in $hid limit $start, $max";
    
    PHP:
    in status1<>3 i used both
    status1<>3
    status1!=3
    PHP:
    but no luck
    $start, $max defined to use limit on result display on a page

    any help
     
    MrPJH, Dec 5, 2011 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    select column from this_table where email=example@example.com limit 0, 10;

    Add single quotes around the email value:

    select column from this_table where email='example@example.com' limit 0, 10;
     
    mfscripts, Dec 6, 2011 IP