Jump to content
Fórum Script Brasil
  • 0

Classe de conexao em Singleton



Bom dia a todos estou tentando criar uma classe de conexao em singleton mais esta dando erro ao instanciala em outra pagina

segue classe


Class slimDAO{
	$instance = NULL;
	function slimDAO(){
	function Conecta(){
		if($instance == NULL){
			$instance = mysqli_connect('','root','');
			echo 'nova instancia do banco de dados';
			die('nao possivel selecionar banco');
			return $instance;

quando instancio ela na outra pagina

$con = new slimDAO();

da o seguinte erro:

Parse error: syntax error, unexpected '$instance' (T_VARIABLE), expecting function (T_FUNCTION) in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\ArquiteturaSistemas\Ex4\slimDAO.php on line 3


alguém poderia me ajudar? 

Edited by Leandro~
esqueci de pedir ajuda
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...