Quote:
|
Originally Posted by edpudol
I guess at this line the problem
Code:
if($_GET['delete']){
$item = $_GET['delete'];
mysql_query("DELETE FROM $table WHERE pilot_id='$id'") or die(mysql_error());
}
You may try the following code
Code:
if($_GET['delete']){
$item = $_GET['delete'];
mysql_query("DELETE FROM $table WHERE pilot_id='$item'") or die(mysql_error());
}
|
I'd like to point out that doing things like this:
Code:
mysql_query("DELETE FROM $table WHERE pilot_id='$item'") or die(mysql_error());
Is a bad habit to get into. You should be very careful when feeding variables into SQL strings. This can lead to whats called an SQL Injection attack, if the variable came from user entered content, such as on a form post or a GET var.
The better practice to get yourself into the habit of:
Code:
$item = mysql_escape_string($_GET['delete']);
mysql_query("DELETE FROM $table WHERE pilot_id='$item'") or die(mysql_error());
If I were a hacker on your site, I could easily delete all the rows in your table by adding some extra content on the URL (unless you escape the incoming data)
See the PHP manual:
PHP: mysql_escape_string - Manual
Regards,
Mark