The code below doesn't show the test you mentioned. By all means testing if
a variable = "" should work, but you may want to try something like
if (!$resultado['Imagem_data']) {
...
}
Sometimes testing a value against "" can cause problems because of
non-appearing whitespace that may exist in the variable. SOMETIMES, not all
the time, and I really couldn't tell you EXACTLY how PHP reacts to some of
these conditions, because I believe it to be system-dependent if memory
serves me (kind of like the differences between "\n" on Unix/Linux and
Windows). Just play around with things, but I'd like to see the code you
are using for this condition.
Mike Frazer
"Rodrigo Peres" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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
> --
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]