Avatar of doctorbill
doctorbill
Flag for United Kingdom of Great Britain and Northern Ireland asked on

php if

Code trial 1:
------------------
$img_path = 'ticktockInt/images/jpg/exclaim.jpg';  

<tr>
           
<td colspan="12" align="center" class="body_bold_black"><a name="remimage" id="remimage"></a>
 <?php if ($row_invoicesReminders['Reminder'] == "Remind") {
                    echo "<li><img src='$img_path;'/><li>";  } ?>
               

       </tr>
        <tr>

Code trial 2:
------------------

$img_path = '<img src="ticktockInt/images/jpg/exclaim.jpg" width="102" height="102" />';

<td>
             
               <?php if ($row_invoicesReminders['Reminder'] == "Remind") {
                    echo $img_path;  } ?></td>
            </tr>


I do not get any errors
PHPScripting LanguagesWeb Development

Avatar of undefined
Last Comment
doctorbill

8/22/2022 - Mon
Marco Gasi

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...
Marco Gasi

Can you show the whole code: query and loop?
doctorbill

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['Name']; ?></td>
              <td align="left" valign="top" nowrap="nowrap" class="totals"><?php echo $row_invoicesReminders['Date']; ?></td><td>
             
               <?php if ($row_invoicesReminders['Reminder'] == "Remind") {
                    echo $img_path;  } ?></td>
            </tr>
            <?php } while ($row_invoicesReminders = mysql_fetch_assoc($invoicesReminders)); ?>
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Marco Gasi

Try this

if (trim($row_invoicesReminders['Reminder']) == "Remind")

Open in new window


Maybe there is some hidden space in your database column...
doctorbill

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
Marco Gasi

Did you try to use trim as I suggested above?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
doctorbill

ASKER
Sorted:
I edited my recordset - it was not referencing all the fields correctly (specifically thyhe "Reminders" field
doctorbill

ASKER
completed
Marco Gasi

What is the solution? Editing the recordset (and how?) or deleting a semicolon? I'm missing something here...
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Ray Paseur

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
doctorbill

ASKER
Marco:
The solution was to edit the recordset and get rid of the ";"
Marco Gasi

Thanks for the explanation :-)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
doctorbill

ASKER
Thanks Ray