Re: Coding Blues - Parse Error
| From: | Oliver Kurz | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Coding Blues - Parse Error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196826@lists.php.net to get a copy of this message | ||
Hello Yusuf,
> <?
> Class fl_SQL
> {
> var $server;
> var $user;
> var $pass;
>
> var $connection;
> var $db;
>
> var $query;
> var $record;
> var $tlist;
> }
The bracket is wrong. Your class only has properties but no methods.
> Function fl_SQL($server, $user, $pass, $db = NULL) {
> $this->server = $server;
> $this->user = $user;
> $this->pass = $pass;
> $this->db = $db;
> }
>
> Function doconnect($db = $this->db){
> $this->db = $db
Missing ;
> $this->connection = mysql_connect($this->server, $this->user,
> $this->pass);
> if (!$this->connect) die ("Could not connect to server!");
$this->connect??? Do you mean $this->connection?
> mysql_select_db($this->db,$this->connection) or die ("Could not
> connect to database!");
> }
>
> Function doquery($query, $db = $this->db){
> $this->db = $db
Missing ;
> $this->connect($this->db);
Do you mean $this->doconnect?
> $this->query = $query
> mysql_query($this->query,$this->connect)
And again: Do you mean $this->connection?
> }
>
> }
Their is the right bracket for the class definition.
> ?>
Also your default-values for the method-parameters have to be constant. So ... try it like in your
constructor. And check it with an if-statement.
And also ... check the names of your properties and methods. It looks like there is a big mess.
So long,
Oliver