[PHP] Dziwny błąd? Dlaczego?

0

Witajcie,
mam poniższy kod:

<?php
    define ('ERROR', 0);
    define ('OK', 1);

    class cDB
    {
         var $host = '';
         var $user = '';
         var $password = '';
         var $resource = NULL;
         var $database = '';
         var $query = '';
         var $result = '';
         var $array = '';

         function connect($cDB_host, $cDB_user, $cDB_password)
         {
             $this->$host = $cDB_host;
             $this->$user = $cDB_user;
             $this->$password = $cDB_password;
             $this->$resource = @mysql_connect($this->$host, $this->$user, $this->$password) or
             return ERROR;
             return OK;
         }

         function database($cDB_database)
         {
             $this->$database = $cDB_database;
             @mysql_select_db($this->$database, $this->$resource) or
             return ERROR;
             return OK;
         }

         function close()
         {
             @mysql_close($this->$resource) or
             return ERROR;
             return OK;
         }

         function error()
         {
             return mysql_error($this->$resource);
         }

         function query($cDB_query)
         {
             $this->$query = $cDB_query;
             $this->$result = @mysql_query($this->$query, $this->$resource) or
             return ERROR;
             return OK;
         }

         function fetch()
         {
             $this->$array = mysql_fetch_array($this->$result) or
             return ERROR;
             return $this->$array;
         }

         function escape($string)
         {
             return mysql_escape_string($string);
         }

         function free()
         {
             @mysql_free_result($this->$result) or
             return ERROR;
             return OK;
         }


    }
?>

i gdy chcę go uruchomić mam błąd:

Parse error: syntax error, unexpected T_RETURN in C:\Program Files\xampp\htdocs\ACK-CMS\index.php on line 22
a linie 22 to

$resource = @mysql_connect($host, $user, $password) or
             return ERROR;

Nie bardzo rozumiem gdzie jest błąd... Jako, że jestem zaawansowanym użytkownikiem PHP jest to dla mnie duża porażka :) Czy mogę prosić o pomoc...

Pozdro
Amadeusz Jasak

0

Może dlatego, że return nie jest funkcją tylko konstrukcją językową a po or musi być konkretna funkcja.

0

Dzięki, nie pomyślałem :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1