Page 1 of 1

Increment

Posted: Fri Sep 03, 2004 1:43 pm
by ol4pr0
i want to update a field by updating the number by one.

Code: Select all

//$query 1 is a insert.
$query2 = "UPDATE users SET ing=ingcount + 1 WHERE unique_id='".$_SESSION['unique_id']."' AND session='".$_COOKIE['PHPSESSID']."'";
$result = mysql_query($query2);
However its not doing.. What am i missing here.

Posted: Fri Sep 03, 2004 2:50 pm
by feyd
SET ing = ing + 1

??

Posted: Fri Sep 03, 2004 4:15 pm
by ol4pr0
However that doesnt seem to work.

Posted: Fri Sep 03, 2004 4:40 pm
by tim
how is your table set-up?

Posted: Fri Sep 03, 2004 5:03 pm
by ol4pr0
i guess u think that that unique id or session doesnt correspond with the row that should be update.
however if i would of do a select

SELECT ing from where with the same it would get that row just fine.

Posted: Fri Sep 03, 2004 5:12 pm
by tim
hmm

the syntax looks good and if u say the table is correctly set-up, I would echo out the query to make sure the cookie n session values are being passed and read correctly in the update line

:?: :?: :?: :?:

Posted: Sat Sep 04, 2004 11:50 am
by ol4pr0
yes they are.. i did an copy and paste and made a select out of it..

still a n3wbie but getting smarter lol.