TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   What am I doing wrong here? (http://www.talkphp.com/general/4143-what-am-i-doing-wrong-here.html)

Sam Granger 04-15-2009 11:06 PM

What am I doing wrong here?
 
PHP Code:

    public function __construct() {
        
$this->dbError '';
        
$this->link null;
    }
    
    
    public function 
dbConnect$config['host'], $config['user'], $config['pswd'], $config['name'] ) {
        
$this->link mysqli_connect($config['host'], $config['user'], $config['pswd'], $config['name']);
        if(
mysqli_connect_errno($this->link)) {
            
$this->dbError mysqli_connect_error($this->link);
            return 
false;
        } else {
            return 
true;
        }
        
    } 

This line:
PHP Code:

    public function dbConnect$config['host'], $config['user'], $config['pswd'], $config['name'] ) { 

gives me the following error:
Quote:

Parse error: syntax error, unexpected '[', expecting ')'
What am I doing wrong? :(

Salathe 04-16-2009 12:08 AM

You can't use an array like that for the function arguments.

PHP Code:

public function dbConnect($host$user$pswd$name) {
    
$this->link mysqli_connect($host$user $pswd$name); 
    
// ...



Sam Granger 04-16-2009 12:41 AM

Awesome, thank you! Bit silly of me :)


All times are GMT. The time now is 08:34 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0