Hartley Posted July 7, 2007 Share Posted July 7, 2007 Hey, I'm working on coding a system that will create a user row in a table, but first, I need the system to check initially to make sure if there is the need to do it (IE: if no row exists for said user). Right now I have it set up to pull out the following: $permissions = "SELECT forumid, memberid, setupstatus FROM user WHERE forumid = " .$_COOKIE['bbuserid']; $permquery = mysql_query($permissions); I want it to check the table to see if there is a row for someone with a specific forumid (I use vBulletin, but it only relates in this case for the cookie). IF it shows up that there is a row, I want it to set $memberstat = 2; so that I can use that variable for various other page functions. If it shows up empty, it will set it equal to 1. How can I achieve this? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 7, 2007 Share Posted July 7, 2007 <?php $permissions = "SELECT forumid, memberid, setupstatus FROM user WHERE forumid = " .$_COOKIE['bbuserid']; $permquery = mysql_query($permissions); if (mysql_num_rows($permquery) > 0){ $memberstat = 2; } else { $memberstat = 1; } ?> Quote Link to comment Share on other sites More sharing options...
Hartley Posted July 7, 2007 Author Share Posted July 7, 2007 Thank you, that fixed 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.