Page 1 of 1

How do i re-write data into a column?

Posted: Sat Aug 31, 2002 1:55 am
by hoopsmax
I want to count how many views a link gets .. but i dont want a new line to be created every time a person clicks a link ...

Is there a way that I can take the original value from the database ... (i know this part) and then add one that that value .... then re-write the new value into the same field you took the old value from?

Please Help.

THANKS

Posted: Sat Aug 31, 2002 12:24 pm
by gotDNS
get the value, (say it's ZERO) from the DB:

Code: Select all

$value = $rowї'value'];
or w/e you do...make it = $value or something, then:

Code: Select all

$value = $value+1;
^ on the page that you want the count for...then right after that, an SQL query:

Code: Select all

"insert into DBName set page_count='$value'";
..that should do it....

later on, -Brian

Posted: Sat Aug 31, 2002 12:52 pm
by hob_goblin
uhm more like

"UPDATE table SET foo = 'foo+1' WHERE bar = 'foobar'"

thanks

Posted: Sat Aug 31, 2002 1:11 pm
by hoopsmax
Thanks guys