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? Link to comment https://forums.phpfreaks.com/topic/105957-solved-if-in-database-do-this/ 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? Link to comment https://forums.phpfreaks.com/topic/105957-solved-if-in-database-do-this/#findComment-543008 Share on other sites More sharing options...
loony383 Posted May 16, 2008 Author Share Posted May 16, 2008 Ok ill try it. Link to comment https://forums.phpfreaks.com/topic/105957-solved-if-in-database-do-this/#findComment-543010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.