Dette burde virker, forbehold for fejl. 
Som du måske vil opdage har jeg rykket din SQL ind i selve klassen. Da jeg mener dette er mere OOP.
På den måde du havde skrevet det skulle man skrive SQL'en hvert sted funktionen blev kaldt.
<?php
class Database {
  //Database connection settings.
  private static $HOST = "localhost";
  private static $USER = "root";
  private static $PASS = "my_pass";
  private static $DB = "my_db";
  //Retrieve a new MySQL Connection.
  public static function open(){
      return @new Mysqli(self::$HOST, self::$USER, self::$PASS, 
  }
  public static function close($connection){
    if ($connection != null && $connection instanceof Mysqli){
      $connection->kill($connection->thread_id);
      $connection->close();
    }
  }
}
?>
<?php
//Inkluder Databasen klassen.
require_once( "databasen.php" );
class specieslist {
  public function getuserinfo($id){
    //Get the MySQL connection.
    $connection = Database::open();
    $id = $connection->escape_string($id);
    $res = $connection->query('SELECT * FROM users WHERE id='.$id);
    while ($row = $result->fetch_assoc()){
      print "Your ID is: ". $row['id'] ."<br />";
    }
    Database::close($connection);
  }
}
$id = strip_tags($_GET['id']);
$splist = new specieslist();
$splist->getuserinfo($id);
?>
						
						
						
						
		
							Indlæg senest redigeret d. 28.11.2011 08:59 af Bruger #5620