Jump to content

Ajuda a remover linha (sql)


skullcrusher
 Share

Recommended Posts

Olá gente.

Estou a tentar fazer um script para remover a linha cujo campo "email" seja igual ao que for recebido no formulário, mas sem sucesso 😄

		
<?php if (!$_POST){  ?>

<form method="post" action="/apagar.php" enctype="multipart/form-data">

<label>Email:</label> <input name="email" type="text" id="email" /></p>
<p><input class="enviar" type="submit"  /></p>

</form>

<?php

} else {

      include("config.php");

        $email_recebido = $_POST["email"];
$result = mysql_query("select email from boleia where email like '$email_recebido'"); 

   while($r=mysql_fetch_array($result)) 
   { 
	  $apagar=$r['email'];
	}

	$sql = "DELETE FROM boleia WHERE email=$apagar LIMIT 1";
	}
        ?>

Já dei altas voltas ao código, às tantas agora está alta trapalhada  😕 Obrigado.

Link to comment
Share on other sites

Tenta assim:

               
<?php if (!$_POST){  ?>

<form method="post" action="/apagar.php" enctype="multipart/form-data">

        <label>Email:</label> <input name="email" type="text" id="email" /></p>
        <p><input class="enviar" type="submit"  /></p>

</form>

<?php

} else {
       
      include("config.php");
      
      $sql = mysql_query("DELETE FROM boleia WHERE email=\"".$_POST["email"]."\" LIMIT 1");
?>

PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.