![]() Topic awaiting preservation: Stupid functions... (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Kansas City, MO , USA |
![]() I have been fighting this for hours it seems... code: function levelwith3up($id,$threeup1db,$threeup2db,$threeup3db) { if($threeup1db == 0 && $threeup2db == 0 && $threeup3db == 0) mysql_query("UPDATE members SET level = 1 WHERE ID = '$id'"); if($threeup1db == 1 && $threeup2db == 1 && $threeup3db == 1) mysql_query("UPDATE members SET level = 2 WHERE ID = '$id'"); if($threeup1db == 2 && $threeup2db == 2 && $threeup3db == 2) mysql_query("UPDATE members SET level = 3 WHERE ID = '$id'"); if($threeup1db == 3 && $threeup2db == 3 && $threeup3db == 3) mysql_query("UPDATE members SET level = 4 WHERE ID = '$id'"); if($threeup1db == 4 && $threeup2db == 4 && $threeup3db == 4) mysql_query("UPDATE members SET level = 5 WHERE ID = '$id'"); }
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() well, I don't see an obvious error, and I can't follow your 'see the update right away' description, code: function levelwith3up($id,$threeup1db,$threeup2db,$threeup3db) { if (($threeup1db == $threeup2db && $threeup1db == $threeup3db) && ($threeup1db >=0 && $threeup1db <= 4) { $new_val = intval($threeup1db) + 1; $id = mysql_real_escape_string($id); //seriously, does PHP still not have a template based sql engine???! mysql_query("UPDATE members SET level = $new_val WHERE ID = '$id'"); } else { error_occurred... } } |
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
![]() Pardon my ignorance, but what is this code supposed to do? |
Obsessive-Compulsive (I) Inmate From: |
![]() I was going to say about escaping $id or otherwise checking that it's not something nasty you're not expecting, beyond that I don't see why it would behave differently! |
Paranoid (IV) Inmate From: Kansas City, MO , USA |
![]() i think it was my debug script causing the problems. it works as it should now. thanks tyberious, you are still the man |