PDA

View Full Version : adding in query


atomicnuke
01-26-2006, 02:59 AM
How can I just had a value to the value in the DB, like:

"UPDATE rate SET totalval='$score', totalvote='' WHERE user_id='$id'";

I want to be able to had certain values to what is in the totalvote, without having to query it, then get the value add the two and reupdate.

Element
01-26-2006, 03:02 AM
You, can't, not that I'm aware of, unless you have the total votes also written to a filee, then just do:

$last_total_votes = file_get_contents("lastvotes.txt");

atomicnuke
01-26-2006, 03:04 AM
Ok, thanks.

fci
01-26-2006, 03:37 AM
I'm not totally sure what you're asking.. did you mean you wanted to do adding in the query like this ?

"UPDATE rate SET totalval=(totalvote+$score), totalvote='' WHERE user_id='$id'";


I would bother creating a file to record it for you if you're already running mysql.