Parse error: syntax error, unexpected T_VAR in /var/www/xxx/

Hier könnt Ihr fragen zu PHP Scriptproblemen diskutieren. Auch Anfängerfragen in Sachen PHP können hier gestellt werden.

Parse error: syntax error, unexpected T_VAR in /var/www/xxx/

Beitragvon SaschasWelt am Do, 17:39:57 11.06.09

Hallo.

Ich bekomme folgende Meldung

Parse error: syntax error, unexpected T_VAR in /var/www/xxx/html/xxx/include/db.inc.php on line 198

  1. <?php
  2.  
  3.  
  4.  
  5. class DB
  6.  
  7. {
  8.  
  9.     // Connection parameters
  10.  
  11.  
  12.  
  13.     var $host = 'localhost';
  14.  
  15.     var $user ="xxxxxx";
  16.  
  17.     var $password ="xxxxxxx";
  18.  
  19.     var $persistent = false;
  20.  
  21.     var $adminid='admin';
  22.  
  23.     var $adminipwd='admin';
  24.  
  25.  
  26.     // Database connection handle
  27.  
  28.     var $conn = NULL;
  29.  
  30.  
  31.  
  32.     // Query result
  33.  
  34.     var $result = false;
  35.  
  36.  
  37.  
  38. //    function DB($host, $user, $password, $database, $persistent = false)
  39.  
  40.     function DB()
  41.  
  42.     {
  43.  
  44.  
  45.  
  46.     }
  47.  
  48.  
  49.  
  50.     function open()
  51.  
  52.     {
  53.  
  54.         // Choose the appropriate connect function
  55.  
  56.         if ($this->persistent) {
  57.  
  58.             $func = 'mysql_pconnect';
  59.  
  60.         } else {
  61.  
  62.             $func = 'mysql_connect';
  63.  
  64.         }
  65.  
  66. }
  67.  
  68.         // Connect to the MySQL server
  69.  
  70.         $this->conn = $func($this->host, $this->user, $this->password);
  71.  
  72.         if (!$this->conn) {
  73.  
  74.             return false;
  75.  
  76.         }
  77.  
  78.  
  79.  
  80.         // Select the requested database
  81.  
  82.         if (!@mysql_select_db($this->database, $this->conn)) {
  83.  
  84.             return false;
  85.  
  86.         }
  87.  
  88.  
  89.  
  90.         return true;
  91.  
  92.  
  93.     function close()
  94.  
  95.     {
  96.  
  97.         return (@mysql_close($this->conn));
  98.  
  99.     }
  100.  
  101.  
  102.  
  103.     function error()
  104.  
  105.     {
  106.  
  107.         return (mysql_error());
  108.  
  109.     }
  110.  
  111.  
  112.  
  113.     function query($sql = '')
  114.  
  115.     {
  116.  
  117.         $this->result = @mysql_query($sql, $this->conn);
  118.  
  119.         return ($this->result != false);
  120.  
  121.     }
  122.  
  123.  
  124.  
  125.     function affectedRows()
  126.  
  127.     {
  128.  
  129.         return (@mysql_affected_rows($this->conn));
  130.  
  131.     }
  132.  
  133.  
  134.  
  135.     function numRows()
  136.  
  137.     {
  138.  
  139.         return (@mysql_num_rows($this->result));
  140.  
  141.     }
  142.  
  143.     function fieldName($field)
  144.  
  145.     {
  146.  
  147.        return (@mysql_field_name($this->result,$field));
  148.  
  149.     }
  150.  
  151.      function insertID()
  152.  
  153.     {
  154.  
  155.         return (@mysql_insert_id($this->conn));
  156.  
  157.     }
  158.  
  159.  
  160.  
  161.     function fetchObject()
  162.  
  163.     {
  164.  
  165.         return (@mysql_fetch_object($this->result, MYSQL_ASSOC));
  166.  
  167.     }
  168.  
  169.  
  170.  
  171.     function fetchArray()
  172.  
  173.     {
  174.  
  175.         return (@mysql_fetch_array($this->result, MYSQL_NUM));
  176.  
  177.     }
  178.  
  179.  
  180.  
  181.     function fetchAssoc()
  182.  
  183.     {
  184.    
  185.    
  186.     var $database ="usr_web31_6";
  187.    
  188.         return (@mysql_fetch_assoc($this->result));
  189.  
  190.     }
  191.  
  192.  
  193.  
  194.     function freeResult()
  195.  
  196.     {
  197.  
  198.         return (@mysql_free_result($this->result));
  199.  
  200.     }
  201.  
  202. }
  203.  
  204.  
  205. define('_BASEURL_','http://aaaaa.berlin-2-go.de');  //protocol required (http://)
  206.  
  207. /*
  208.  
  209. define('_BASEURLCSSNEW_','http://static.css.influxive.info/greenfairnew');
  210.  
  211. define('_BASEURLICONS_','http://wcons.df.influxive.info/greenfairnew');
  212.  
  213. define('_BASEURLHOWITWORKS_','http://oi.how.it.influxive.info/greenfairnew');
  214.  
  215. define('_BASEURLTEMPLATEIMAGE_','http://ti.ak.img.influxive.info/greenfairnew');
  216.  
  217. define('_BASEURLMEDIA_','http://media.fr.influxive.info/greenfairnew');
  218.  
  219. define('_BASEURLMEDIAIMAGES_','http://img.zs.ch.influxive.info/greenfairnew');
  220.  
  221. */
  222.  
  223.  
  224.  
  225. define('_BASEURLCSSNEW_','/div2');
  226.  
  227. define('_BASEURLICONS_','/div2');
  228.  
  229. define('_BASEURLHOWITWORKS_','/div2');
  230.  
  231. define('_BASEURLTEMPLATEIMAGE_','/div2');
  232.  
  233. define('_BASEURLMEDIA_','/div2');
  234.  
  235. define('_BASEURLMEDIAIMAGES_','/div2');
  236.  
  237.  
  238.  
  239. define('_BASEPATH_','/var/www/xxxxx/html/aaaaa');
  240.  
  241. define('_IMAGESURL_',_BASEURL_.'/images');
  242.  
  243. define('_IMAGESPATH_',_BASEPATH_.'/images');
  244.  
  245. define('_IMAGESURLM_',_BASEURL_.'notesimages');
  246.  
  247. define('_IMAGESPATHM_',_BASEPATH_.'notesimages');
  248.  
  249. define('_ADMIN_MAIL_','info@berlin-2-go.de');
  250.  
  251. define('_TITLE_','Money Auctions | ');
  252.  
  253. define('_TITLE1_','Money Auctions ');
  254.  
  255. $accepted_upload_extensions_pics = array('gif','jpg','jpeg','png');
  256.  
  257.  
  258.  
  259. function get_uname($uid){
  260.  
  261.     $sql="select * from user where id='$uid'";
  262.  
  263.     $myrwd=mysql_query($sql);
  264.  
  265.     $myuname=mysql_fetch_array($myrwd);
  266.  
  267.     $uname=$myuname['uname'];
  268.  
  269.     return $uname;
  270.  
  271. }
  272.  
  273.  
  274.  
  275.  
  276.  
  277. ?>




Ich habe die ganze code durchgesucht und leider keine Fehler gefunden.

Falls jemand was findet, bitte korregieren Sie diese Code oder sagen Sie wo ein Fehler ist.

Zeile 198:
  1.        return (@mysql_free_result($this->result));


MfG

Sascha
SaschasWelt
Newbi
 
Beiträge: 1
Registriert: Do, 17:34:50 11.06.09

Re: Parse error: syntax error, unexpected T_VAR in /var/www/xxx/

Beitragvon Marcel am Sa, 19:39:49 13.06.09

In der Zeile 66 ist eine } die dort kein Sinn macht, eher in Zeile 91. Dann ist das hier var $database ="usr_web31_6"; in der Zeile 186 Sinnfrei sowas würde eher oben in die class passen.
MfG
Marcel
Marcel
Member
 
Beiträge: 542
Registriert: Di, 16:13:41 3.01.06

Zurück zu PHP Hilfe



cron