Thread: FIRST Topsite?
View Single Post
  #43   Spotlight this post!  
Unread 03-03-2005, 20:48
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: FIRST Topsite?

Quote:
Originally Posted by Calvin
Ok we just had one of those MySQL errors. The image thing worked (the error.gif) was displayed, but it slowed down the website a bit.

Here is the code used:

PHP Code:
mysql_connect($hostname,$username,$password);
if(
mysql_error() == "")
{
// Display the right image
}
elseif (
mysql_error() != "")
{
    
header("Location: " "http://franklin.f2o.org/topsite/error.gif" "");

It seems to be taking alot of time trying to connect... is there a faster way to try connect, and VERY fast say if there is a error or not?

hmmm how about:
PHP Code:
$link = @mysql_connect($hostname,$username,$password);
if (!
$link
{
    
header("Location: " "http://franklin.f2o.org/topsite/error.gif" "");

Would that speed it up, as far as testing goes?
It would be slightly faster but only by a little bit, there should be no reason that a small if statement should make it bigger, also you may want to use function die() after you complete the header() function like this, to speed up the reloading of the image to the image file.
PHP Code:
$link = @mysql_connect($hostname,$username,$password);
if (!
$link
{
    
header("Location: " "http://franklin.f2o.org/topsite/error.gif" "");
    die();

__________________
- from B B frank