Inva
Printable View
Inva
well...
1) RightLoginTime is never set because you never run $query2
2) I think $query4 should be:if I'm not mistaken.PHP Code:$query4 = "INSERT INTO accounts VALUES ((Distance), ('$LogoutTime - $RightLoginTime'))";
Short of that, put in some echos and make sure that your variables are being set to something.
Inva
OHHHH... I see your problem now. You're making it a string instead of using PHP variables. I should have seen that before. :rolleyes:
Something like that.. you may have to play around with single quotes (I'm not sure if they're necessary with mysql).PHP Code:$query4 = "INSERT INTO accounts VALUES (" . $Distance . ", (" . $LogoutTime - $RightLoginTime . "))";
And again, I think your SQL statement is wrong. Where is that going to insert into? You should have a key that you update with an INSERT statement and then a WHERE clause in an UPDATE statement that you use to update the values.
Inva
Well, I don't know the structure of your table, so it's hard for me to tell you what it would look like. But it's going to be similar to your other UPDATE queries. You'll just use the SET whatever = the PHP variable, and make sure to use the " . $phpvar . " notation after the equal sign. And you'll have to have a WHERE clause in the statement that will point to whatever index value or primary key of the record you're updating.
Inva
Sorry, I'm at work. No can do.
Actually, I was able to get on... what's your SN?
Inva
Inva
That's plainly invalid, the right sides of the equal operations are missing.Quote:
WHERE UserName=
AND Password=