Página de Busca
Pessoal,Estou construindo um form principal responsável pelo cadastamento, exclusão e atualização! Para o usuario fazer uma busca no sistema ele terá que apertar um botão, com isso chamaria uma pagina específica de busca! Aí é que está o problema!! Esta pagina ta com alguns erros. Vejam os erros e os codigos abaixo:Erros
Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at end of input at character 62 in c:\arquivos de programas\apache group\Apache\htdocs\teste\busca.php on line 34Warning: pg_num_rows(): supplied argument is not a valid PostgreSQL result resource in c:\arquivos de programas\apache group\Apache\htdocs\teste\busca.php on line 38Warning: pg_fetch_array() expects parameter 1 to be resource, boolean given in c:\arquivos de programas\apache group\Apache\htdocs\teste\busca.php on line 43
Codigo:<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Cadastro de Médicos</title><link href="css/index.css" rel="stylesheet" type="text/css"><style type="text/css"><!--body { background-color: #E3EACE; margin-top: 14px;}--></style></head><body><form name="formulario" id="formulario" action="busca.php" method="post" target="resultado"><table width="400" height="120" border="0" cellpadding="1" bgcolor="#EEEEEE"> <tr bgcolor="#FFFFFF"> <td colspan="7"><img src="img/busca_usu.gif" align="absmiddle">Busca de Pacientes </td> </tr> <tr> <td colspan="7">Filtrar por: </td> </tr> <tr> <td>Nome:</td> <td colspan="5"><input name="nome" type="text" id="nome" value="" size="40" maxlength="40"></td> <td><input type="submit" name="Submit" value="Buscar" onClick=""></td> </tr> <?include "Connections/conexao.php";$query = "select codpaciente,nome,nomemae from tb_paciente where nome =" . $_GET['nome'];$resposta= pg_query("$query");// total de registros encontrados$registros=pg_num_rows($resposta);// criando um array com o total de registros logo abaixo$u=0;while($registro=pg_fetch_array($resposta)){$resultado[$u]=$registro['nome'];$u++;};// exibindo os registros$linhas=round($registros/3);// criando tabela de exibicaoecho('<table border=1>');$x=0;$arquivos=0;for($i=1; $i<$linhas;$i++){//criando linhaecho('<tr>');// criando célulaswhile($x<$registros && $arquivos<3){echo('<td>'.$resultado[$x].'</td>');;$x++;$arquivos++;};$arquivos=0;// fechando linhaecho('</tr>');};// fechando tabelaecho('</table>');?></table></form></body></html>Discussão (16)
Carregando comentários...