Whiteangel Posted February 19, 2014 at 11:55 AM Report #545778 Posted February 19, 2014 at 11:55 AM Alguém me ajuda aqui porque é que ele nao verifica se o nome existe na base de dados?? $nome=$_POST ['Nome']; $conexao=mysql_connect('localhost','root','1807'); if (!$conexao) {echo ' falha na ligação. </br>'; echo mysql_error(); exit;} mysql_select_db("empresa",$conexao); $sql = "SELECT nome FROM clientes"; // efectuar a query/instrução anteriormente guardada em $sql e armazenar o registo seleccionado na variável array $resultado $resultado1 = mysql_query ($sql); // se a condição "if ($resultado)" verificar que a variável array $resultado está preenchida c/ dados da tabela // então assume um valor positivo/verdadeiro e permite a continuação da execução do código // que se encontra entre as chavetas {...} if ($resultado1) { $resultado=mysql_query("select* from clientes where nome='".$nome."'"); echo ' <form name="formularioPesquisa11" method="POST" action="http://localhost/Gestao_Empresarial/AlterarClientes1.php">'; while($row= mysql_fetch_array($resultado)){ echo '<blockquote style="padding-left:5px">'; echo ' '; echo '<input type="hidden" name="id" id="id" value="'.$row['id'].'"/><font color="#FFFFFF" size="3" face="Verdana" >Nome:</font><label style="padding-left:8px"><input type="text" name="nome" value="'.$row['nome'].'" class="textboxNome"><p></label>'; echo ' '; echo '<font color="#FFFFFF" size="3" face="Verdana" >Morada:</font><label style="padding-left:8px"><input type="text" name="morada" value="'.$row['morada'].'" class="textboxNome"<p><p style="padding-left:15px"></label> '; echo '<font color="#FFFFFF" size="3" face="Verdana" >Localidade:</font><label style="padding-left:8px"><input type="text" name="localidade" value="'.$row['localidade'].'" class="textboxNome" ><p></label>'; echo ' '; echo '<font color="#FFFFFF" size="3" face="Verdana" >E-mail:</font><label style="padding-left:8px"><input type="text" name="email"value="'.$row['email'].'" class="textboxNome"><p></label>'; echo ' '; echo '<font color="#FFFFFF" size="3" face="Verdana" >Telf/Telm:</font><label style="padding-left:8px"><input type="text" name="telefone" value="'.$row['telefone'].'" class="textboxTelefone"></label>'; echo ' '; echo '<font color="#FFFFFF" size="3" face="Verdana" >Nif:</font><label style="padding-left:8px"><input type="text" name="nif" value="'.$row['nif'].'" class="textboxTelefone"></label>'; echo ' <a href="http://localhost/Gestao_Empresarial/AlterarClientes1.php"" /><input type="submit" class= "botao" value="Alterar" name="Guardar" id="Guardar"/></a>'; echo '</blockquote>'; echo '</form>'; } } else { // enviar a seguinte informação p/ o browser print ("Não há registos"); } mysql_close($conexao);
I-NOZex Posted February 19, 2014 at 12:05 PM Report #545780 Posted February 19, 2014 at 12:05 PM mete espaço entre o select e o * B2R » Beat2Revolution v3.0b | Regista e divulga-nos beat2revolution.net
taviroquai Posted February 19, 2014 at 01:50 PM Report #545793 Posted February 19, 2014 at 01:50 PM Na 1a linha tens um espaço a mais entre $_POST e ['nome']
Whiteangel Posted February 21, 2014 at 03:20 PM Author Report #546066 Posted February 21, 2014 at 03:20 PM Na 1a linha tens um espaço a mais entre $_POST e ['nome'] Mesmo assim, não dá mete espaço entre o select e o * Mesmo assim, não dá
apocsantos Posted February 21, 2014 at 04:55 PM Report #546070 Posted February 21, 2014 at 04:55 PM Boa tarde, $resultado=mysql_query("select * from clientes where nome=' " $nome "' "); Cordiais cumprimentos, Apocsantos "A paciência é uma das coisas que se aprendeu na era do 48k" O respeito é como a escrita de código, uma vez perdido, dificilmente se retoma o habito"
Whiteangel Posted February 21, 2014 at 05:02 PM Author Report #546071 Posted February 21, 2014 at 05:02 PM resolvido
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now