php mysql session help

Codes here !

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: php mysql session help

Post by seandisanti » Fri Mar 01, 2013 12:20 pm

You actually have a few issues going on here. the first is that you're using 'edit' instead of 'UPDATE'. sql isn't case sensitive, but it's common practice to make sql keywords all caps, and definitely using the right word helps immensely. :D You also only have to use the word 'SET' once in your update query. In addition to that, on your individual assignments in the sql string, you don't want to quote the field names, because that turns them into literal strings, but you DO want to put quotes around the string values and numeric values do not need to be quoted. so this line:
$query = "edit logindetail set 'firstname'=$firstname, set 'lastname'=$lastname', set 'gender'=$gender, set 'birthday'=$birthday,set 'city'=$city, set 'state'=$state WHERE id ='$_SESSION[Suserid]'";
would become....

Code: Select all

$query = "UPDATE logindetail SET firstname='". $firstname . "', lastname='". $lastname . "', gender='" . $gender . "', birthday='" . $birthday . "',city='". $city . "',state='" . $state . "' WHERE id=" . $_SESSION['suserid'];
 

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests