Need help with this PHP Script! Please help

Discussion in 'PHP' started by UberSoftware, Nov 13, 2008.

  1. #1
    mysql_query("UPDATE bizgame_players SET money = money + $Price where id='".$PlayerID."'") or die(mysql_error());
    Code (markup):
    mysql_query("UPDATE bizgame_players SET money = money - $Price where name='$_SESSION[username]' and pass='$_SESSION[password]'") or die(mysql_error());
    Code (markup):
    $Price = $row['price'];
    Code (markup):

    It does not add or subtract the variable from the MYSQL user.

    How can I fix this? Please help!

    Thanks in advance :)
     
    UberSoftware, Nov 13, 2008 IP
  2. rene7705

    rene7705 Peon

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    call mysql_error() after the mysql_query and see what it returns?
    you might need to pass a connection variable to both mysql_query and mysql_error to get the latter to work properly..
     
    rene7705, Nov 13, 2008 IP
  3. UberSoftware

    UberSoftware Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Problem is their are no errors everything works properly. It doesn't process the variable though.
     
    UberSoftware, Nov 13, 2008 IP
  4. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    mysql_query("UPDATE bizgame_players SET money = money + '$Price' WHERE id='$PlayerID'") or die(mysql_error());
    Code (markup):
    mysql_query("UPDATE bizgame_players SET money = money - '$Price' WHERE name='$_SESSION[username]' and pass='$_SESSION[password]'") or die(mysql_error());
    Code (markup):
     
    garrettheel, Nov 13, 2008 IP
  5. rene7705

    rene7705 Peon

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    did you pass a connection parameter to both functions?
     
    rene7705, Nov 13, 2008 IP
  6. UberSoftware

    UberSoftware Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I fixed it guys thanks for all your help!!! :)
     
    UberSoftware, Nov 13, 2008 IP