jonnewbie12 Posted October 29, 2011 Share Posted October 29, 2011 Sorry to be a newbie. I am writing some code that is supposed to query a row in my database. If that row returns the value "yes" I want to display a text or image. It is currently being written within a pop up box, hence within the <span> parameters. Problem is it just doesnt work and was hoping someone could tell me why. Have I got too many brackets? Should the values in the PHP admin table be set differently? The bit I am having trouble is the 'IF commands". Although the row 'moisture' has a yes value in the database it does not perform the echo. The code is below:[/b][/b] <a href="<?php echo $row_Recordset1['fabricpicture']; ?>" class="MagicZoomPlus" rel="caption-source:span;caption-position:right" title="<?php echo $row_Recordset1['fabricgroup']; ?> <?php echo $row_Recordset1['E']; ?>"> <img src="<?php echo $row_Recordset1['fabricpicture']; ?>" name="Grey" width="100" height="100" border="0" class="MagicZoomPlus" id="Grey"/> <span><strong><?php echo $row_Recordset1['fabricgroup']; ?> <?php echo $row_Recordset1['E']; ?></strong> </p> <?php echo $row_Recordset1['fabricmaterial']?> </P> Max Width = <?php echo $row_Recordset1['width']?> </p> Max Drop = <?php echo $row_Recordset1['drop']?> </p> <?php if ($rowRecordset1['moisture']=="yes") {echo "moisture resistant";} ?> </p> <?php if ($rowRecordset1['flame'] == "yes") {echo "flame retardant";} ?></span>. </a> Quote Link to comment https://forums.phpfreaks.com/topic/250043-php-if-command-not-working-when-returning-a-value/ Share on other sites More sharing options...
Pikachu2000 Posted October 29, 2011 Share Posted October 29, 2011 var_dump the database values and make sure they are identical to the strings to which they're being compared. I'd guess there's probably whitespace causing the comparison to fail. Quote Link to comment https://forums.phpfreaks.com/topic/250043-php-if-command-not-working-when-returning-a-value/#findComment-1283247 Share on other sites More sharing options...
jonnewbie12 Posted October 29, 2011 Author Share Posted October 29, 2011 Sorry as name suggests a newbie! Var dump? Strings the same? Sorry. Quote Link to comment https://forums.phpfreaks.com/topic/250043-php-if-command-not-working-when-returning-a-value/#findComment-1283248 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.