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? Quote 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. } } ?> Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/72500-solved-query-checking/#findComment-365581 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.