Jump to content

Php and MySQL Inefficient


Fuzzley

Recommended Posts

PHP version      5.2.6

MySQL version    5.0.51a

 

I have this little PHP script to save visitor information:

 

$dbh = mysql_connect($hostname, $username, $password); 
@mysql_select_db($datab); 
$time=date("'Y','m','d','l','h','i','s'"); 
$query = "INSERT INTO $sitename VALUES ('','$ip','$ref','$user_id',$time,'no','no','$proxy','$forp','$via')"; 
mysql_query($query); 
mysql_close($dbh);

 

The script works fine for regular users. The problem is that it is too slow for bots (search engine crawlers). I'm guessing the bots wait until the page finishes loading. But because the script is slowish (opens database, writes to it, closes it every time) the bots give up. The page that implements the script has even fallen off google's listing. Is there any way to speed up the opening/closing process? Or is there a way to check if the visitor is a bot?

 

Thanks for any help.

Link to comment
https://forums.phpfreaks.com/topic/230167-php-and-mysql-inefficient/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.