[PHP] Problems with a simple While-If condition

2002-11-26 Thread Rodrigo de Oliveira
This is the fact:

I'm building a homepage that can access a mysql database, and display the records 
within a certain condition. Following this it is verified if the sql result was empty 
then  it should write a certain frase, if not it should write the records. I've got 
the worst part ok, the while that display the results, but the if isn't being 
verified, it writes the frase anyway.
Please help, the code is right under the file name:


indicador.php

?
include db_dados.php;
?
?  $sql = SELECT * FROM tb_tao WHERE area='$area'and status=1;
$res = @mysql_query($sql,$id)
?

?
echo table width='100%' height='100%' border='0' align='center'
?

?
echo trtddiv align='center'Nenhum profissional cadastrado./div/td/tr;
?
?
while ($row = mysql_fetch_array($res)) {
?
?
echotrtdID Profissional/td;
echotd.$row['id']./td/tr;

echotrtdNome/td;
echotd.$row['nome']./td/tr;

echotrtdProfissão/td;
echotd.$row['area']./td/tr;

echotrtdBairro/td;
echotd.$row['bairro']./td/tr;

echotrtdTelefone/td;
echotd.$row['telefone']./td/tr;

echotrtdE-mail/td;
echotd.$row['email']./td/tr;

echotrtdTelefone Celular/td;
echotd.$row['celular']./td/tr;

echotrtdRegistro Profissional/td;
echotd.$row['regprof']./td/tr;

echotrtdEndereço/td;
echotd.$row['endereco']./td/tr;

echotrtdnbsp;/td;
echotdnbsp;/td/tr;


?
?
 }
?
?
echo/table;
?


db_dados.php

?
$id = mysql_connect(localhost,rodrigo,g3mston3)or die ('I cannot connect to the 
database.');
$con = mysql_select_db(db_tao);
?



Re: [PHP] Problems with a simple While-If condition

2002-11-26 Thread Bret L Conard
There does not seem to be an 'IF' statement?

Bret


Register your Domain for as little as $8.95 yr.
At pgaws.com
Find a contractor or find a contract at Tech-Temp.com

- Original Message -
From: Rodrigo de Oliveira [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 26, 2002 6:47 PM
Subject: [PHP] Problems with a simple While-If condition


This is the fact:

I'm building a homepage that can access a mysql database, and display the
records within a certain condition. Following this it is verified if the sql
result was empty then  it should write a certain frase, if not it should
write the records. I've got the worst part ok, the while that display the
results, but the if isn't being verified, it writes the frase anyway.
Please help, the code is right under the file name:


indicador.php

?
include db_dados.php;
?
?  $sql = SELECT * FROM tb_tao WHERE area='$area'and status=1;
$res = @mysql_query($sql,$id)
?

?
echo table width='100%' height='100%' border='0' align='center'
?

?
echo trtddiv align='center'Nenhum profissional
cadastrado./div/td/tr;
?
?
while ($row = mysql_fetch_array($res)) {
?
?
echotrtdID Profissional/td;
echotd.$row['id']./td/tr;

echotrtdNome/td;
echotd.$row['nome']./td/tr;

echotrtdProfissão/td;
echotd.$row['area']./td/tr;

echotrtdBairro/td;
echotd.$row['bairro']./td/tr;

echotrtdTelefone/td;
echotd.$row['telefone']./td/tr;

echotrtdE-mail/td;
echotd.$row['email']./td/tr;

echotrtdTelefone Celular/td;
echotd.$row['celular']./td/tr;

echotrtdRegistro Profissional/td;
echotd.$row['regprof']./td/tr;

echotrtdEndereço/td;
echotd.$row['endereco']./td/tr;

echotrtdnbsp;/td;
echotdnbsp;/td/tr;


?
?
 }
?
?
echo/table;
?


db_dados.php

?
$id = mysql_connect(localhost,rodrigo,g3mston3)or die ('I cannot
connect to the database.');
$con = mysql_select_db(db_tao);
?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php