mysql update error

Discussion in 'PHP' started by benifactor, Sep 11, 2009.

  1. #1
    :(

    this is the code:

    
    mysql_query("UPDATE bts_blog set read = read + 1 where id = '$_GET[id]'") OR DIE(mysql_error());
    
    PHP:
    and this is the error from the die()

    now ideally, when the code is run, it should take the integer from the db, and add one to it. so 'read' = 0 or some other integer, and after the page loads it should then be 1. all of the other update that i have work in this format so maybe im just missing something simple... thanks for any help.
     
    benifactor, Sep 11, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    mysql_query("UPDATE bts_blog set `read` = `read` + 1 where id = " . mysql_real_escape_string($_GET['id'])) OR DIE(mysql_error());
    
    PHP:
     
    premiumscripts, Sep 11, 2009 IP
  3. benifactor

    benifactor Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank you kind sir. i had the escape strings in there but i took it out for testing.
     
    benifactor, Sep 11, 2009 IP
  4. dweebsonduty

    dweebsonduty Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    Digital Goods:
    1
    #4
    Or you could assign a var to the GET.
     
    dweebsonduty, Sep 12, 2009 IP