Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what if a blob is empty

Status
Not open for further replies.

sandravega

Programmer
Feb 10, 2004
43
AR
Hi,
I'm new to this forum (and almost new to PHP)

I'm retrieving images from a table, using this code:
<td><img src=&quot;image.php?id=<?php echo $id; ?>&quot;></td>

where the basic code for IMAGE.PHP is:

<?php
require(&quot;config.inc&quot;);
global $id;
$sql = &quot;SELECT imagen FROM imagenes WHERE id=$id&quot;;

$result = @mysql_query($sql,$connection) or die(&quot;Couldn't execute

query.&quot;);

$row = mysql_fetch_array($result);
$src = $row['imagen'];

echo $src;
?>

This is really not sophisticated code, but it works...

But not every register has an image in it, so I get the red cross in my output page. I really want image.php to determine if the blob field is empty, and return something nicer than the mark of a lost image. (maybe just an empty cell in my table)
I tried functions like is_null or is_object to query blob data from MySQL, but I can't find the right way.

Sorry if my english isn't good enough (I apreciate every language correction!)

Thank you all

Sandra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top