Re: [PHP] Last visitors

2005-04-20 Thread Ryan A
Hey, > Why are you setting the profile_id equal to a value when you also have > that in your WHERE clause? I may have missed something here, but I > though the purpose of this was to track the last ten visitors to a > certain page, and if this is the case, why increment the user_id when > updatin

Re: [PHP] Last visitors

2005-04-20 Thread John Nichel
Ryan A wrote: then from my php script (test_last_visitors.php) I ran this test SQL: $SQL = "UPDATE test_last_visitors SET profile_id=".$profile_id.", user_id=user_id+1, ttimestamp=now() WHERE profile_id=1 ORDER BY ttimestamp ASC LIMIT 1"; Why are you setting the profile_id equal to a value when yo

RE: [PHP] Last visitors

2005-04-20 Thread Ryan A
> Theres something wrong coz its not working as expected... > I followed instructions and created a table like this: > > > CREATE TABLE test_last_visitors ( > profile_id int(10) default NULL, > user_id int(10) default NULL, > ttimestamp timestamp(14) NOT NULL) TYPE=MyISAM; > > then I ran this

RE: [PHP] Last visitors

2005-04-20 Thread Tom Crimmins
On Wednesday, April 20, 2005 09:57, Ryan A wrote: > >>> Thanks for replying, I tried using the test example of Petar >>> Nedyalkov, but when i try to create the following: >> >>> CREATE TABLE `profile_log` ( >>>`profile_id` int(10) default NULL, >>>`user_id` int(10) default NULL, >>>

RE: [PHP] Last visitors

2005-04-20 Thread Ryan A
> > Thanks for replying, I tried using the test example of Petar > > Nedyalkov, but when i try to create the following: > > > CREATE TABLE `profile_log` ( > >`profile_id` int(10) default NULL, > >`user_id` int(10) default NULL, > >`last_login` timestamp NOT NULL > > ) ENGINE=MyISAM CH

RE: [PHP] Last visitors

2005-04-20 Thread Tom Crimmins
On Tuesday, April 19, 2005 18:46, Ryan A wrote: > Hey, > Thanks for replying, I tried using the test example of Petar > Nedyalkov, but when i try to create the following: > > CREATE TABLE `profile_log` ( >`profile_id` int(10) default NULL, >`user_id` int(10) default NULL, >`last_log

Re: [PHP] Last visitors

2005-04-19 Thread Richard Lynch
On Tue, April 19, 2005 5:57 am, Ryan A said: > On the profile page there should be "last 10 visitors", it will not > register > the guests, but if someone had logged in and visited your profile, it > should > show their usernameif there are 10 enteries in the db and when the > 11th > person com

Re: [PHP] Last visitors

2005-04-19 Thread Richard Lynch
On Tue, April 19, 2005 4:46 pm, Ryan A said: > Hey, > Thanks for replying, I tried using the test example of Petar Nedyalkov, > but > when i try to create the following: > > CREATE TABLE `profile_log` ( >`profile_id` int(10) default NULL, >`user_id` int(10) default NULL, >`last_login`

Re: [PHP] Last visitors

2005-04-19 Thread Ryan A
Hey, Thanks for replying, I tried using the test example of Petar Nedyalkov, but when i try to create the following: CREATE TABLE `profile_log` ( `profile_id` int(10) default NULL, `user_id` int(10) default NULL, `last_login` timestamp NOT NULL ) ENGINE=MyISAM CHARSET=utf8 I get an err

Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Christopher Fulton
> I did, the problem is the client is on a box with mySql 3.23.x or 4.0.x, he > is deciding to upgrade to a dedicated box but then the host he is looking at > says they will charge him if they are to upgrade to mysql 4.1 (hence i cant > even use sub-selects) > (Sorry I didnt mention the MySql versi

Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:42, Tom Crimmins wrote: > On Tuesday, April 19, 2005 09:09, John Nichel wrote: > > Petar Nedyalkov wrote: > > > > > >> You can store only 10 records for each user by using the following > >> logic: > >> > >> mysql> show create table profile_log\G > >> **

Re: [PHP] Last visitors

2005-04-19 Thread Tom Crimmins
On Tuesday, April 19, 2005 09:09, John Nichel wrote: > Petar Nedyalkov wrote: > >> You can store only 10 records for each user by using the following >> logic: >> >> mysql> show create table profile_log\G >> *** 1. row *** >> Table: profile

Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Ryan A
Hey, Thanks for replying. > Check my reply. I did, the problem is the client is on a box with mySql 3.23.x or 4.0.x, he is deciding to upgrade to a dedicated box but then the host he is looking at says they will charge him if they are to upgrade to mysql 4.1 (hence i cant even use sub-selects) (S

Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Mike Hummel
just do a select limit 11 display up to 11... if less then 11, you might want to display them anyways. you should be able to deal with up to a million + records, so select will stay quick, esp if you make the right fields indexed. you can take care of purging via crons... you might find you want

Re: [PHP] Last visitors

2005-04-19 Thread John Nichel
Petar Nedyalkov wrote: MySQL 4.1.8 Damn, too bad. We're still using 4.0.x and aren't going to be upgrading anytime in the near future. Thanks for the info on that though...it's an interesting feature, and one more thing I can add to the list of reasons why we need to upgrade. -- John C. Nic

Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:08, John Nichel wrote: > Petar Nedyalkov wrote: > > > > You can store only 10 records for each user by using the following logic: > > > > mysql> show create table profile_log\G > > *** 1. row *** > >Table: profile_

Re: [PHP] Last visitors

2005-04-19 Thread John Nichel
Petar Nedyalkov wrote: You can store only 10 records for each user by using the following logic: mysql> show create table profile_log\G *** 1. row *** Table: profile_log Create Table: CREATE TABLE `profile_log` ( `profile_id` int(10) default

Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:03, Ryan A wrote: > Hey! > I think I solved this: > > select 11 latest visitors > count to see if it returned 11 records, > > if (count == 11){ > get the oldest (of the 11) visitors time > delete everything from that record and older than that > } > else{} > > Pros: max

Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Ryan A
Hey! I think I solved this: select 11 latest visitors count to see if it returned 11 records, if (count == 11){ get the oldest (of the 11) visitors time delete everything from that record and older than that } else{} Pros: max 2 queries If i am missing anything or you see any problem in my logi

Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 16:27, Ryan A wrote: > > I am not checking for the last people logged in, I want to see the last > > people who have viewed the profile... > > each profile will have its own last "10 people visited" > > /* > ah! i see. sorry for misunderstanding you. > perhaps on the script

Re: [PHP] Last visitors

2005-04-19 Thread Ryan A
> what if you have something like 1000 users on your system. > > you'd have 1000 txt files! :( > the DB seems to be a better idea as it's > probably more expandable... > > you can do other queries to it and stuff... whereas 1000 txt files > > will be a pain in the butt to keep track of. Too t

Re: [PHP] Last visitors

2005-04-19 Thread Ken
what if you have something like 1000 users on your system. you'd have 1000 txt files! :( the DB seems to be a better idea as it's probably more expandable... you can do other queries to it and stuff... whereas 1000 txt files will be a pain in the butt to keep track of. On 4/19/05, Ryan A <[EMAIL P

RE: [PHP] Last visitors

2005-04-19 Thread Ryan A
Hey, > Couple of options: a CRON job/scheduled job which invokes a SQL command > deleting all but the 10 most recent records, **I dont think this would be very effective, as there might be thousands of profiles and each gets their last 10 visitors, some would be more popular than others >or do t

Re: [PHP] Last visitors

2005-04-19 Thread Ken
On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > > I am not checking for the last people logged in, I want to see the last > > people who have viewed the profile... > > each profile will have its own last "10 people visited" > > /* > ah! i see. sorry for misunderstanding you. > perhaps on the scrip

RE: [PHP] Last visitors

2005-04-19 Thread Ryan A
Hey, > As to exactly how you decide which are the most recent 10 records to do > > this deletion, that is a little more complex. Yep, for sure > Something like > > DELETE FROM profile_visits > > WHERE user='billy' > > AND time_of_visit NOT IN ( > > Select time_of_visit > > FROM > > profile_visi

Re: [PHP] Last visitors

2005-04-19 Thread Duncan Hill
On Tuesday 19 April 2005 14:27, Ryan A typed: > SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit > DESC LIMIT 10 > As for cleaning up... that's the bit that I can't figure out myself :(. > */ > > Hey, > Thanks for replying. > > > ah! i see. sorry for misunderstanding you. > >

FW: [PHP] Last visitors

2005-04-19 Thread Mark Rees
From: Ryan A [mailto:[EMAIL PROTECTED] Sent: 19 April 2005 14:27 To: [EMAIL PROTECTED] Cc: php Subject: Re: [PHP] Last visitors > I am not checking for the last people logged in, I want to see the > last people who have viewed the profile... each profile will have its > own last &quo

Re: [PHP] Last visitors

2005-04-19 Thread Ryan A
> I am not checking for the last people logged in, I want to see the last > people who have viewed the profile... > each profile will have its own last "10 people visited" /* ah! i see. sorry for misunderstanding you. perhaps on the script for the profiles page, the logic should be like: profile

[PHP] Last visitors

2005-04-19 Thread Ken
On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > > >> the site works like this: > > > if you are a "guest" you can see only limited details of a profile, if > > you > > > have logged in, you see many more details. > > > On the profile page there should be "last 10 visitors", it will not > > registe

Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 15:57, Ryan A wrote: > Hey, > Am a bit puzzled as to how to do this, I am modifying a profiles/dating > site, the site works like this: > if you are a "guest" you can see only limited details of a profile, if you > have logged in, you see many more details. > > On the profi

Re: [PHP] Last visitors

2005-04-19 Thread Ryan A
>> the site works like this: > > if you are a "guest" you can see only limited details of a profile, if > you > > have logged in, you see many more details. > > On the profile page there should be "last 10 visitors", it will not > register > > the guests, but if someone had logged in and visited y

Re: [PHP] Last visitors

2005-04-19 Thread Ken
On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > Hey, > Am a bit puzzled as to how to do this, I am modifying a profiles/dating > site, the site works like this: > if you are a "guest" you can see only limited details of a profile, if you > have logged in, you see many more details. > > On the prof

[PHP] Last visitors

2005-04-19 Thread Ryan A
Hey, Am a bit puzzled as to how to do this, I am modifying a profiles/dating site, the site works like this: if you are a "guest" you can see only limited details of a profile, if you have logged in, you see many more details. On the profile page there should be "last 10 visitors", it will not reg