Click here to Skip to main content
14,690,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 20:28pm
v2
Comments
Ron Beyer 21-Aug-13 21:58pm
   
Are you escaping the strings anywhere?

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...
$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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900