$_GET['id'] Undefined index?

Hi guys, I am getting this error on my delete page.

Undefined index: id on line 6

Here is my code in which I am using the $_GET method, I also have the ID in the URL of that page.

$result = mysql_query("SELECT * FROM `items` WHERE `id` = '$_GET[id]'");

Any help would be kindly appreciated.

Kind regards,

Jordan

Could you put the whole code in please.

That is all i need to put in, it’s just in that query.

Try to change your code to this:
[php]$result = mysql_query(“SELECT * FROM items WHERE id = '”.mysql_real_escape_string($_GET[‘id’])."’");[/php]

Could you please do one for DELETE too?

Thanks!

Remove quotes around ‘items’ and ‘id’ in the query and like phphelp said, escape your strings.

Sponsor our Newsletter | Privacy Policy | Terms of Service