loony383 Posted May 16, 2008 Share Posted May 16, 2008 Is it possible (and if so how) to check if a file in an database has a value set to 1 (value called reported) then if it isnt it sets it to 1 and if it is then it comes up with an error? Quote Link to comment Share on other sites More sharing options...
jonsjava Posted May 16, 2008 Share Posted May 16, 2008 yes. $sql = "SELECT * FROM `table` WHERE `value`='1' AND `some_other_thing`='something else';"; $result = mysql_query($sql); if ($result){ print "error"; } else{ mysql_query("UPDATE `table` SET `value`='1' WHERE `some_other_thing`='something else';"); } I would help more if I knew more about what you are doing. Could you give us something to work with? Quote Link to comment Share on other sites More sharing options...
loony383 Posted May 16, 2008 Author Share Posted May 16, 2008 Ok ill try it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.