I make such a request:

mysql_query("DELETE FROM message WHERE username='".$_SESSION['username']."'")or die(mysql_error()); 

But he does not do anything, and still need to delete all the records, please tell me the error

  • do you have a message table? True, you know exactly what is being passed to $ _SESSION ['username']? - Artem
  • everything is exactly there - oOKomarOo
  • If everything is there, then you are obviously too smart. Miracles, after all, does not happen. - Vitaly Kustov

3 answers 3

Request to variable: $q="DELETE FROM message WHERE username='".$_SESSION['username']."'"; Make a dump or simply print it out. Enter your request in mysqld or PMA and see the server response. We write it here

  • What is the type of correct answer? gut I'm sticking with you! - Artem
  • Yes, it's the same joke, what is there to be surprised then =) - Zowie
  • ahah !!!!!!! - Artem

Well then so

 mysql_query("DELETE FROM message WHERE username='".$_SESSION['username']."' LIMIT 1")or die(mysql_error()); 

If it doesn't help, then var_dump ($ _ SESSION) to the studio

    Try this:

      $username = $_SESSION['username']; mysql_query("DELETE FROM message WHERE username='$username'")or die(mysql_error());