Jump to content
Fórum Script Brasil
  • 0

Php Deletar+mysql


Guest nicholas aguiar dias

Question

Guest nicholas aguiar dias

Por que não Deleta o registro..

alguém pode me ajudar.?

o que esta de errado

<?php

// conectar mysql

$conectar_banco = mysql_connect('localhost','root');

// Conectar Banco

mysql_select_db('banco');

//Pega a variavel do formulario

$user_db = $HTTP_POST_VARS["user_form"];

$pass_db = $HTTP_POST_VARS["pass_form"];

/* Seleciona a tabela */

$select = mysql_query("SELECT * FROM as_login_db WHERE user=$user_db' AND pass='$pass_db' ");

if( $row = @mysql_fetch_array($select) ){

$user_txt = $row['user];

{

/* Deleta os campos de login,senha e url */

$wsql =("DELETE FROM as_login_adm WHERE user='nicholas' AND pass='sbla4598' ");

mysql_query($wsql);

print("<br><br><center>Usuário deletado com sucesso</center>");

}

else

{

print("<br><br><center>Este usuário não existe</center>");

}

exit;

?>

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Tenta assim:

/Pega a variavel do formulario

$user_db = $_POST["user_form"];

$pass_db = $_POST["pass_form"];

/* Seleciona a tabela */

$select = mysql_query("SELECT * FROM as_login_db WHERE user=$user_db' AND pass='$pass_db' ");

if( $row = @mysql_fetch_array($select) ){

$id = $row["id];

$user_txt = $row['user'];

{

/* Deleta os campos de login,senha e url */

$wsql =("DELETE FROM as_login_adm WHERE id = '$id'");

mysql_query($wsql);

print("<br><br><center>Usuário deletado com sucesso</center>");

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...