sandravega
Programmer
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="image.php?id=<?php echo $id; ?>"></td>
where the basic code for IMAGE.PHP is:
<?php
require("config.inc"
;
global $id;
$sql = "SELECT imagen FROM imagenes WHERE id=$id";
$result = @mysql_query($sql,$connection) or die("Couldn't execute
query."
;
$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
I'm new to this forum (and almost new to PHP)
I'm retrieving images from a table, using this code:
<td><img src="image.php?id=<?php echo $id; ?>"></td>
where the basic code for IMAGE.PHP is:
<?php
require("config.inc"
global $id;
$sql = "SELECT imagen FROM imagenes WHERE id=$id";
$result = @mysql_query($sql,$connection) or die("Couldn't execute
query."
$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