Jump to content

[SOLVED] How to display alternative image if database record is empty?


Recommended Posts

HI everyone,

 

I am beginner in PHP and I need help with little 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:

 

<?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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.