0

Hello Everyone,

I am trying to delete some rows from a given table using mysql and php. No errors come up, the page doesn't die, however the records are not deleted!

Here's the code

$delete_temp_query=("DELETE FROM temporary where contactemail='".$emailcheck."'");
  $delete_temp=($delete_temp_query) or die(mysql_error());

The value of $emailcheck is

$emailcheck = $_POST['email'];

which is an email received from a form.

I printed the query onscreen, it states:

The query to be executed is:

DELETE FROM temporary where contactemail='someone@somewhere.com'

I tried running this command in the phpmyadmin sql dialog and it deletes the records! (asking for a confirmation first).

Any Ideas?

Thanks in advance!

Anto

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by wachichornia
0
$delete_temp_query=("DELETE FROM temporary where contactemail='".$emailcheck."'");
  $delete_temp=($delete_temp_query) or die(mysql_error());

look at the dots that enclosed the $emailcheck variable. this is the right one try this.

$delete_temp_query=("DELETE FROM temporary where contactemail='$emailcheck'");
  $delete_temp=($delete_temp_query) or die(mysql_error());
0

try this

$delete_temp_query="DELETE FROM temporary where contactemail='".$emailcheck."'";
    $delete_temp=mysql_query($delete_temp_query) or die(mysql_error());
0

OK,
I tried both things, they didn't work.
Nevertheless, I've been looking around in forums, and apparently copying data from one table to another and then deleting from the previous table is not a very clean way to do things. I'll modify my code to avoid doing this then.
Thanks a lot anyway for your replies!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.