RE: [PHP] Going Crazy Logic.
| From: | John Holmes | Date: | Sun, 02 Jun 2002 07:04:38 +0000 |
| Subject: | RE: [PHP] Going Crazy Logic. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100298@lists.php.net to get a copy of this message | ||
MySQL_affected_rows()
---John Holmes...
> -----Original Message-----
> From: r [mailto:r@jumac.com]
> Sent: Sunday, June 02, 2002 3:39 PM
> To: php-general@lists.php.net
> Subject: [PHP] Going Crazy Logic.
>
> Hi PPL,
> 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.
> -Ryan.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php