SirChick Posted October 9, 2007 Share Posted October 9, 2007 How do i do a if statement after a query to do something like "if the row does exist.. set value = 1 else set to = 0" This is my query so far: $Check = mysql_query("SELECT * FROM Banks WHERE UserID='{$_SESSION['Current_User']}' AND BankID='1'"); Any ideas? Link to comment https://forums.phpfreaks.com/topic/72500-solved-query-checking/ Share on other sites More sharing options...
trq Posted October 9, 2007 Share Posted October 9, 2007 <?php if ($Check = mysql_query("SELECT * FROM Banks WHERE UserID='{$_SESSION['Current_User']}' AND BankID='1'")) { if (mysql_num_rows($Check)) { // row exists } else { // row does not exist. } } ?> Link to comment https://forums.phpfreaks.com/topic/72500-solved-query-checking/#findComment-365575 Share on other sites More sharing options...
SirChick Posted October 9, 2007 Author Share Posted October 9, 2007 thanks Link to comment https://forums.phpfreaks.com/topic/72500-solved-query-checking/#findComment-365581 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.