what is the problem here???
Posted: Fri Nov 20, 2009 4:35 am
hy all,
Im trying to run a script that search a client, and then after it finds it, i want to show the values that this client have.
Im doing it like this...
But in this way, i got this error --->
Line 18 is the 2º while ->>
Then i put the variable aux like this --->>
And this error happears --->
I dont know what to do
... can u guys help me on this? thx
Im trying to run a script that search a client, and then after it finds it, i want to show the values that this client have.
Im doing it like this...
Code: Select all
<?php if(isset($_POST['submit']))
{
$nome =($_POST['nome']);
$executa="SHOW TABLES";
echo "<center><font face=Verdana size=2><b>Tabelas da base de dados</b></font></center><br>";
$query = mysql_query("SELECT * FROM pacientes WHERE nome = '".mysql_real_escape_string($nome)."'");
echo "<table>";
while ($dados=mysql_fetch_array($query)) {
echo "<tr><td><font face=Verdana size=2 color=#333300><B>Nome
da tabela => $dados[0]</td></tr>";
$executa="DESCRIBE $dados[0]";
$aux=mysql_query($executa);
while ($atributos=mysql_fetch_array($aux)) {
echo "<tr><td><font face=Verdana size=1>$atributos[0]</td><td>
<font face=Verdana size=1>| $atributos[1]</td><td>
<font face=Verdana size=1>| $atributos[3]</td></tr>"; }
echo "</table>"; }
}else { $nome = '';}
?>Code: Select all
[b][i]Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\Secretel\pesquisar_pacientes.php on line 18
Nome da tabela => 7[/i][/b]Code: Select all
[i][b]while ($atributos=mysql_fetch_array($aux)) {[/b][/i]Code: Select all
[b][i]$aux=mysql_query($executa) or die(mysql_error());[/i][/b]Code: Select all
[b][i]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '7' at line 1
Nome da tabela => 7
[/i][/b]I dont know what to do