You'll have to check if the result is NULL or not.  Try this

<? echo ($row_Recordset1['imagecolumn'] != "NULL" ||
($row_Recordset1['imagecolumn'] != "") ? "<img
src=\"".$row_Recordset1['imagecolumn']."\">" : ""; ?>

This is print out nothing if your result is equal to null.  

On another notes, how do you specify the width and height of this image?
Or the alt tag, or set the  border so that on older versions on Netscape
it does not default to 1.

Why don't you try saving the entire image tag in the db, for example

<img src="image.gif" width="12" height="30" alt="Image" border="0">

and then you can use the same code from above

 
---> Jonathan
 
 
 

-----Original Message-----
From: Daniel Crompton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 03, 2003 1:20 PM
To: [EMAIL PROTECTED]
Subject: Mysql / PHP image link problem.

I have a mysql table column called 'imagecolumn'  The rows contain links
i.e.

image.gif
image.gif
null
image.gif
image.gif

To display in my web page im using:

<img src="<?php echo $row_Recordset1['imagecolumn']; ?>"> 

This displays the above images in my html page

The problem i have is where the field in my table is left blank (null),
a web browser shows this as a broken image link icon.  i.e. it doesn't
ignore it.

Does anyone know how I can get my page to ignore it if there is no link.






-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to