doctorbill
asked on
php if
Code trial 1:
------------------
$img_path = 'ticktockInt/images/jpg/ex claim.jpg' ;
<tr>
<td colspan="12" align="center" class="body_bold_black"><a name="remimage" id="remimage"></a>
<?php if ($row_invoicesReminders['R eminder'] == "Remind") {
echo "<li><img src='$img_path;'/><li>"; } ?>
</tr>
<tr>
Code trial 2:
------------------
$img_path = '<img src="ticktockInt/images/jp g/exclaim. jpg" width="102" height="102" />';
<td>
<?php if ($row_invoicesReminders['R eminder'] == "Remind") {
echo $img_path; } ?></td>
</tr>
I do not get any errors
------------------
$img_path = 'ticktockInt/images/jpg/ex
<tr>
<td colspan="12" align="center" class="body_bold_black"><a
<?php if ($row_invoicesReminders['R
echo "<li><img src='$img_path;'/><li>"; } ?>
</tr>
<tr>
Code trial 2:
------------------
$img_path = '<img src="ticktockInt/images/jp
<td>
<?php if ($row_invoicesReminders['R
echo $img_path; } ?></td>
</tr>
I do not get any errors
Php is case-sensitive: are you sure the value should be 'Remind' and not 'remind'? And the same quetion can be done about the column name...
Can you show the whole code: query and loop?
ASKER
<?php do { ?>
<tr>
<td align="left" valign="top" class="totals"><?php echo $row_invoicesReminders['ID ']; ?></td>
<td align="left" valign="top" class="totals"><?php echo $row_invoicesReminders['Na me']; ?></td>
<td align="left" valign="top" nowrap="nowrap" class="totals"><?php echo $row_invoicesReminders['Da te']; ?></td><td>
<?php if ($row_invoicesReminders['R eminder'] == "Remind") {
echo $img_path; } ?></td>
</tr>
<?php } while ($row_invoicesReminders = mysql_fetch_assoc($invoice sReminders )); ?>
<tr>
<td align="left" valign="top" class="totals"><?php echo $row_invoicesReminders['ID
<td align="left" valign="top" class="totals"><?php echo $row_invoicesReminders['Na
<td align="left" valign="top" nowrap="nowrap" class="totals"><?php echo $row_invoicesReminders['Da
<?php if ($row_invoicesReminders['R
echo $img_path; } ?></td>
</tr>
<?php } while ($row_invoicesReminders = mysql_fetch_assoc($invoice
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this
Maybe there is some hidden space in your database column...
if (trim($row_invoicesReminders['Reminder']) == "Remind")
Maybe there is some hidden space in your database column...
ASKER
Dave:
If I just put this into the page:
echo "<img src='$img_path'/>"; } ?>
I get the inage
So it vlooks as if there is a problem with the IF statement
If I just put this into the page:
echo "<img src='$img_path'/>"; } ?>
I get the inage
So it vlooks as if there is a problem with the IF statement
Did you try to use trim as I suggested above?
ASKER
Sorted:
I edited my recordset - it was not referencing all the fields correctly (specifically thyhe "Reminders" field
I edited my recordset - it was not referencing all the fields correctly (specifically thyhe "Reminders" field
ASKER
completed
What is the solution? Editing the recordset (and how?) or deleting a semicolon? I'm missing something here...
Going forward, a useful concept in PHP programming is the use of HEREDOC notation to make templates and HTML fragments that are later used in creating a complete web page. Once you know how this works, it will revolutionize your programming and design practices. Just a thought...
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
ASKER
Marco:
The solution was to edit the recordset and get rid of the ";"
The solution was to edit the recordset and get rid of the ";"
Thanks for the explanation :-)
ASKER
Thanks Ray