Making Cool Mysql Error Page Using PHP

Discussion in 'PHP' started by astkboy2008, Jan 16, 2010.

  1. #1
    some times my mysql is down because of for example the server load so i generate this code
    Benefits


    • it give you cool html/css page if the connection to mysql is lost becuase of for example the user or password is incorrect.
    • It prevents search engines from archiving the current page and this is great becuase its an error page and this by this code:
    • <meta name="robots" content="noindex,nofollow">
      HTML:

    • it tells search engine crawlers how long to wait before trying again, which is the main advantage of using this method. The text on the page can be formatted any way you want, to inform human visitors what the problem is.
    see the demo


    [​IMG]


    Cautions

    Before making any changes to your config.php, save a copy of the original so you can revert to it if necessary.
    
    if (!$connect) {
    include ("noconnection.html");
    exit;
    }
    
    PHP:
    $connect is the mysql_select_db function for example read the config example:config.php [336 B].exit; is working on stop the page after include the html file
    Html/Css

    use quick view tool:noconnection.html [1.31 KB]

    open your config file and try to modify it with this condition

    the tutorial page
    downlaod the zip files:cool-mysql-error-page.zip [33.29 KB]
     
    astkboy2008, Jan 16, 2010 IP