How to update table data with data stored in session?
I have following code but it is not working(INSERTING INTO DB not working exactly). Please not that this is just part of the code. Session value are being saved correctly. I have a problem with saving them though.
If I have made silly mistake – apologies – I’m newby.
$loggedTime = $_SESSION['loggedtime'];
$thisUser = $_SESSION['usr'];
$result = mysql_query("UPDATE 'admin' SET dt = $loggedTime WHERE $thisuser");
if($result) {
echo "success";
} else {
echo "no success";
}
Don’t use single quotes around column/table names. Single/double quotes indicate string literals. Use back ticks around table/column names, if you have to (i.e. reserved word). Also, have a look at Bobby Tables. Furthermore, you need a column in the
whereclause.