Page 1 of 1

How to display aternative image if database record is empty?

Posted: Fri Apr 17, 2009 11:28 pm
by hemangi
HI everyone,

I am beginner in PHP and I need help with the code.
I am making a web site in Dreamweaver using MySql database and PHP.
I have image address in row 10 of the database table and I display them well but they only exist for some of the records, not all. But when I place the recordset on the page and test it in browser-it displays the image when the recordset contains it's address, but it displayes an empty image (like broken link one) for all the rest of the records.
What I need is simple if else statement in php to tell it to display alternative image or nothing when the row record is empty.
I have this code, but is obviously wrong because it gives me an error:

Code: Select all

<?php if ($row_rsList['WL']==""){
echo "images/emptyGraphic.gif"}?>
              <?php else
 
        echo $row_rsList['WL'] />
"rsList" is my recordset in dreamweaver which contains all the table rows and "WL" is row number 10.
I place instances of all the row in the page, like phone:... email:... etc and I also would like to know how to make them not show if the record is empty. Instead I have now empty line where this record was supposed to be. I would like it to ignore the line and bring the next record directly under it.

Can you please help me !!!

Regards,
Emiliya