Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailemVyřešeno php, po použití $this->xxx nefunguje, vypíše pouze text xxx až do konce souboru

index.php:

require_once('Sql.php');
$sql = new Sql(); //na tomto řádku chyba: PHP Fatal error:  Class 'Sql' not found in /srv/http/index.php on line 29
Sql.php:
<?
class Sql
	{
//_CONSTANTS_///////////////////////////////////////////////////////////////////
//_VARIABLES_///////////////////////////////////////////////////////////////////
	/***************************************************************************
	* Database connection
	* @var string
	*/
	private $connect;
	
//_CONSTRUCTOR_/////////////////////////////////////////////////////////////////
	/***************************************************************************
	* Connect to database
	* @return void
	*/
	function __construct()
		{
		$this->connect = mysqli_connect("127.0.0.1","root","toor") 
			or die ('<b>Critical error!</b><br>Can\'t connect to database: ' . mysqli_error());
		mysqli_select_db($this->connect, "portfolio")
			or die ('Bad database name');
		mysqli_set_charset($this->connect, "utf8")
			or die ('Can\'t set default database charset');
		
		mysqli_query($this->connect, "SET character_set_client=utf8");
		mysqli_query($this->connect, "SET character_set_connection=utf8");
		mysqli_query($this->connect, "SET character_set_results=utf8");
		mysqli_query($this->connect, "set names 'utf8'");
		}


	}// end of class
?>

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny