get image from DB problem
| From: | Rodrigo Peres | Date: | Fri, 25 Jan 2002 14:28:15 +0000 |
| Subject: | get image from DB problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-82097@lists.php.net to get a copy of this message | ||
List,
I'm using the following code to retrieve image from Mysql. My problem is how
can I output another image if the given ID doesn't have an image on it??? I
had already inserted a blank gif in the database in order to use it, but
I've tried to check if ($resultado['Imagem_data'] == "") or null and
outputs the blank gif, but didn't work.
$conexao = new conexao();
$query = new Query($conexao);
$sql = "SELECT Imagem_data,Imagem_type FROM imagens WHERE
CelebID='$celebID'";
$query->executa($sql);
$resultado = $query->dados();
$imagem_banco = $resultado['Imagem_data'];
$type = $resultado['Imagem_type'];
if($imagem_banco != "") {
HEADER("Content-type: $type");
echo($imagem_banco);
}
Thank's
Rodrigo