help with the mysql delete please!

Discussion in 'PHP' started by benifactor, Sep 19, 2010.

  1. #1
    mysql_query("DELETE from bts_picks WHERE uidt = $_POST[uid] AND p1 = $getData[$t]") or DIE(mysql_error());
    PHP:
    i get this error

    Unknown column 'pick0809' in 'where clause'
     
    benifactor, Sep 19, 2010 IP
  2. WWSD

    WWSD Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What is stored inside the $getData[$t] variable? "pick0809" i assume?
    try this:
    mysql_query("DELETE from bts_picks WHERE uidt = '$_POST[uid]' AND p1 = '$getData[$t]'") or DIE(mysql_error());
    I added single quotes around the variables
     
    WWSD, Sep 19, 2010 IP
  3. sunlcik

    sunlcik Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Actually ,

    mysql_query("DELETE from bts_picks WHERE uidt = '$_POST[uid]' AND p1 = '$getData[$t]'") or DIE(mysql_error());
    PHP:
    It may be correct...
     
    sunlcik, Sep 19, 2010 IP
  4. almedajohnson

    almedajohnson Peon

    Messages:
    140
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    absolutely right. Just put the single quotes around the parameters as per the syntax
     
    almedajohnson, Sep 19, 2010 IP