- <?php
- /*
- * Created on 2011-5-16
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
- try{
- $conn=mysql_connect("lolhost","kakaxi","");
- echo $conn;
- if(!$conn)
- {
- throw new mysql_exception("couldn't connect to database'");
- }
- }catch(mysql_exception $e)
- {
- echo $e->getMessage();
- echo $e->getmysqlerror();
- }
- class mysql_exception extends Exception{
- protected $mysqlerror;
- public function __construct($message=null,$code=0)
- {
- $this->mysqlerror=mysql_error();
- parent::__construct($message,$code);
- }
- public function getmysqlerror()
- {
- return $this->mysqlerror;
- }
- }
- ?>