Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

undefined index id

Codes here !

Moderators: macek, egami, gesf

undefined index id

Postby jagjittcl » Sun Jul 07, 2013 10:32 pm

Hi

I am getting the above error on line

$query = "select id,firstname FROM master WHERE id " .$_GET['id'];


$(document).on('click', '.editBtn', function(){
$.ajax({
url: 'update_form.php',
data: {'id' : $(this).closest('td').find('.userId').text()},
dataType: 'json',
success: function(data)
{
console.log(data)

}
});

});
Thanks
jagjittcl
New php-forum User
New php-forum User
 
Posts: 9
Joined: Wed Jul 03, 2013 10:14 pm

Re: undefined index id

Postby johnj » Mon Jul 08, 2013 3:08 am

you need to validate $_GET['id']. you need to verify if this id has a value. You can use isset() to do this.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.