Guest User

Untitled

a guest
Oct 24th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2. include "conexao.php";
  3. $nome = strip_tags($_POST['nome']);
  4. $pesquisar = mysql_query("SELECT * FROM listaredxote WHERE nome = '$nome'"); //verifica se existe $nome na tabela
  5. $contagem = mysql_num_rows($pesquisar); //conta em quantas linhas o $nome ja existe
  6. if($nome != "" && $contagem != 1){
  7. mysql_query("INSERT INTO listaredxote (nome) VALUES ('$nome')");
  8. echo "Cadastrado com sucesso";
  9. }
  10. ?>
Add Comment
Please, Sign In to add comment