Jump to content

PHP If command not working when returning a value


jonnewbie12

Recommended Posts

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>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.