Click here to Skip to main content
14,665,327 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, i am trying to update logged in user data into existing row in mysql database but data is not updated. Here is my mysql query-
update users set text=[$_SESSION['txt'] where username=$_SESSION['myvaruser'] and password=$_SESSION['myvarpass'];
,
however it is only working if i set cookies instead of session and i want data should be updated when remember me checkbox not selected also. Please tell me whats wrong?
Posted
Updated 21-Aug-13 19:28pm
v2
Comments
Ron Beyer 21-Aug-13 21:58pm
   
Are you escaping the strings anywhere?

Rate this:
Please Sign up or sign in to vote.

Solution 1

Try

$text=$_SESSION['txt'];
$username=$_SESSION['myvaruser'];
$password=$_SESSION['myvarpass'];
update users set text=$text where username=$username and password=$password;
   
Comments
Pankaj Mahor 22-Aug-13 9:26am
   
Problem solved, thanx.
Jitendra Sabat 22-Aug-13 9:28am
   
Welcome...
Rate this:
Please Sign up or sign in to vote.

Solution 2

$txt=$_SESSION['txt'];
$username=$_SESSION['myvaruser'];
$password=$_SESSION['myvarpass'];

$query="update users set text='".$txt."' where username='".$username."' and password='".$password."'";
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100