RE: [PHP] Last visitors

From: Date: Wed, 20 Apr 2005 13:35:51 +0000
Subject: RE: [PHP] Last visitors
Groups: php.general 
Request: Send a blank email to php-general+get-213506@lists.php.net to get a copy of this message
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_login timestamp NOT NULL > ) ENGINE=MyISAM CHARSET=utf8 > > > I get an error on both > ENGINE=MyISAM > and > CHARSET=utf8 > > What are they for really? can I omit them? or will that effect the > program later on? > > Thanks, > Ryan You can leave these off. Changing ENGINE to TYPE will fix that error, and you can leave off the charset. I believe utf8 was added in 4.1. If you leave off charset=xxx it will just default to whatever the server's default-character-set is set to, probably latin1. > On 4/19/2005 4:42:08 PM, Tom Crimmins (php@pottcounty.com) wrote: >> On Tuesday, April 19, 2005 09:09, John Nichel wrote: >>> Petar Nedyalkov wrote: >>> <snip> >>>> 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 NULL, >>>> user_id int(10) default NULL, >>>> timestamp timestamp NOT NULL default >>>> CURRENT_TIMESTAMP on >>>> update >>>> CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=utf8 >>>> 1 row in set (0.00 sec) >>>> >>>> When you create a profile you fill 10 blank records with timestamp >>>> 0000-00-00 00:00:00. >>>> >>>> Then if a user sees a profile: >>>> >>>> PSEUDO SQL: >>>> >>>> $SQL = "UPDATE profile_log SET user_id=".$userId. " WHERE >>>> profile_id=". $profileId." ORDER BY timestamp ASC LIMIT 1 -- Tom Crimmins Interface Specialist Pottawattamie County, Iowa

« previous php.general (#213506) next »