MasterACE14 Posted March 26, 2008 Share Posted March 26, 2008 hey guys, I started learning SQLite a few days ago, and can really see the advantages of the flat file database... Basically, I currently have a script I use to see how many people are "Currently Online" on my website. It uses MySQL. I am wondering if it would be better(speed and server load wise, not that it would take much server load ) if I used SQLite instead? If so, would the same "MySQL CLAUSES" such as DISTINCT etc... are able to work in SQLite? as I know the WHERE clause works, im just not sure about some of the others. here's my current script: <?php function active_sessions() { /** * * TG WHO'S ONLINE * Copyright 2005 - 2006 (c) TOXIC GOBLIN * http://www.toxicgoblin.com * */ //Optional Database Connection Information //**Uncomment the following 2 lines and edit the values if you do not already have an active database connection** // //Fetch Time $timestamp = time(); $timeout = $timestamp - 900; //Insert User $insert = mysql_query("INSERT INTO cf_whos_online (timestamp, ip, file) VALUES('$timestamp','".$_SERVER['REMOTE_ADDR']."','".$_SERVER['PHP_SELF']."')") or die("Error in who's online insert query!"); //Delete Users $delete = mysql_query("DELETE FROM cf_whos_online WHERE timestamp<$timeout") or die("Error in who's online delete query!"); //Fetch Users Online $result = mysql_query("SELECT DISTINCT ip FROM cf_whos_online") or die("Error in who's online result query!"); $users = mysql_num_rows($result); //Show Who's Online if($users == 1) { print("Online Now: $users"); } else { print("Online Now: $users"); } }; ?> any help is greatly appreciated as always Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/97903-whos-online-script-run-faster-and-more-effectively-in-mysql-or-sqlite/ Share on other sites More sharing options...
MasterACE14 Posted March 27, 2008 Author Share Posted March 27, 2008 bump Quote Link to comment https://forums.phpfreaks.com/topic/97903-whos-online-script-run-faster-and-more-effectively-in-mysql-or-sqlite/#findComment-502036 Share on other sites More sharing options...
MadTechie Posted March 27, 2008 Share Posted March 27, 2008 SQLite, is slower in the long run. as for the "MySQL CLAUSES" you really should read up on SQLite if your planning to use it! Quote Link to comment https://forums.phpfreaks.com/topic/97903-whos-online-script-run-faster-and-more-effectively-in-mysql-or-sqlite/#findComment-502042 Share on other sites More sharing options...
MasterACE14 Posted March 28, 2008 Author Share Posted March 28, 2008 ok, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/97903-whos-online-script-run-faster-and-more-effectively-in-mysql-or-sqlite/#findComment-502904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.