Please see if you can solve this problem as its driving me crazy..its for a
small affiliate program.

I have a table with the folling structure:
** table stats(Id bigint,Month tinyint,Year int,Hits bigint)

The client will be given a link like this
** http://mysite.com/affiliates/hit.php?id=155

then this will execute in the script (the connection part is done)
** update table stats set hits=hits+1 where Id=$Id and MONTH(now())=Month
and YEAR(current_date)=Year

/*The logic in the above is that I am updating "hits" by one only if "month"
and "Year" match up, so I can track which affiliate has given me the most
traffic, just 12 records for each client per year and excellient dynamic
tracking......? */

but if the fields "Month" or "Year" do not match the update will not work
and will not return anything right? so I want to execute this SQL then
** insert into stats values($Id,MONTH(now()),YEAR(CURRENT_DATE),1)

Either i'm brain dead,tired,dumb,just overworked, or this one great
problem....but I cant figure it out......

Any help appreciated, thanks in advance.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to