Answered
PHP if else help please
I have to admit that this is the first time I have tried
conditional statements and am struggling a bit although I think I'm
getting closer.
I have a dynamic table from a test recordset in which there are only 4 records.
I am trying to get the layout cell to alter colour depending on the contactnt of that cell.
Here is where I am so far...
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td>TYPE</td>
</tr>
<?php do { ?>
<tr>
<?php if ($row_Recordset1['NOTETYPE'] ="NOTE")?><td bgcolor="#CCCCCC"><?php echo $row_Recordset1['NOTETYPE']; ?>
<?php elseif ($row_Recordset1['NOTETYPE'] ="Action")?><td bgcolor="#00FFCC"><?php echo $row_Recordset1['NOTETYPE']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
Firstly, it seem to create another layout cell to the right of the first (not intended) and it doesn't like the elseif.
What am I doing wrong - does it need a loop?
I have a dynamic table from a test recordset in which there are only 4 records.
I am trying to get the layout cell to alter colour depending on the contactnt of that cell.
Here is where I am so far...
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td>TYPE</td>
</tr>
<?php do { ?>
<tr>
<?php if ($row_Recordset1['NOTETYPE'] ="NOTE")?><td bgcolor="#CCCCCC"><?php echo $row_Recordset1['NOTETYPE']; ?>
<?php elseif ($row_Recordset1['NOTETYPE'] ="Action")?><td bgcolor="#00FFCC"><?php echo $row_Recordset1['NOTETYPE']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
Firstly, it seem to create another layout cell to the right of the first (not intended) and it doesn't like the elseif.
What am I doing wrong - does it need a loop?
