webbiz Posted December 29, 2005 Share Posted December 29, 2005 I need to show information if a recordset is = to a set MySQL table varchar value. In this case the value is “reg_lev_user_1". The following code works to show if there is a record: // code start <?php if ($totalRows_Recordset_access_level > 0) { // Show if recordset not empty ?> Test text <?php } // Show if recordset not empty ?> // code end However, when I adapt the above code to the code below it does not work. In fact the box around the ‘test text’ with the heading ‘Show If’ is replaced with a PHP tag (not sure what they are called). I have tried using single, double and no quotation marks around the text variable and I have echoed the variable on the same page to make sure it is correct. Could someone tell me what I’m doing wrong with this code? // code start <?php if ($totalRows_Recordset_access_level == "reg_lev_user_1") { // Show if recordset not empty ?> <p>Test text </p> <?php } // Show if recordset not empty ?> // code end Quote Link to comment https://forums.phpfreaks.com/topic/3114-show-if-text-variable-is-to-record/ Share on other sites More sharing options...
degsy Posted January 5, 2006 Share Posted January 5, 2006 $totalRows_Recordset_access_level You are comparing to the wrong variable. totalRows is just that. It is the count of rows found. If you want to check against the value then it would be something like <?php if ($row_access_level['user_level'] == "reg_lev_user_1") Quote Link to comment https://forums.phpfreaks.com/topic/3114-show-if-text-variable-is-to-record/#findComment-10617 Share on other sites More sharing options...
webbiz Posted January 5, 2006 Author Share Posted January 5, 2006 Hi thanks. I did work it out once I got some sleep. Thanks again [!--quoteo(post=333513:date=Jan 6 2006, 12:09 AM:name=degsy)--][div class=\'quotetop\']QUOTE(degsy @ Jan 6 2006, 12:09 AM) 333513[/snapback][/div][div class=\'quotemain\'][!--quotec--] $totalRows_Recordset_access_level You are comparing to the wrong variable. totalRows is just that. It is the count of rows found. If you want to check against the value then it would be something like <?php if ($row_access_level['user_level'] == "reg_lev_user_1") Quote Link to comment https://forums.phpfreaks.com/topic/3114-show-if-text-variable-is-to-record/#findComment-10622 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.