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

$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());

try this

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

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.