Jump to content

[SOLVED] Why not just delete?


Bullet

Recommended Posts

Your code would work only if you have register_globals on. If so, I suggest to turn it off in your php.ini as it is deprecated and removed from the upcoming php6. A normal code should be:

 

<?php
if(isset($_POST['clear'])){
     $username = mysql_real_escape_string($_POST['clear']); //or whatever post variable you are using
     $results = mysql_query("DELETE FROM search WHERE username='$username'");
     echo 'All searches deleted';
}
?>

 

I also modified the query as the delete syntax is: "DELETE FROM table WHERE column='value'" and smart quotes aren't necessary. Try it and see if it works now.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.