Forum Moderators: coopster

Message Too Old, No Replies

Parse error: syntax error, unexpected T VAR

new to this but trying to learn

         

BrandNew

3:03 am on Aug 7, 2009 (gmt 0)

10+ Year Member



Parse error: syntax error, unexpected T_VAR in /home/kilander/public_html/include/db.inc.php on line 198

This is a script that I picked up and have been trying to get to work for me, but I get the afore mentioned Error Message. Posted below is the code, I have been racking myself over this, but being new to PHP am probably missing something very simple...any ideas.

<?php

class DB

{

// Connection parameters

var $host = 'localhost';

var $user ="***";

var $password ="***";

var $persistent = false;

var $adminid='admin';

var $adminipwd='admin';

// Database connection handle

var $conn = NULL;

// Query result

var $result = false;

// function DB($host, $user, $password, $database, $persistent = false)

function DB()

{

}

function open()

{

// Choose the appropriate connect function

if ($this->persistent) {

$func = 'mysql_pconnect';

} else {

$func = 'mysql_connect';

}

// Connect to the MySQL server

$this->conn = $func($this->host, $this->user, $this->password);

if (!$this->conn) {

return false;

}

// Select the requested database

if (!@mysql_select_db($this->database, $this->conn)) {

return false;

}

return true;

}

function close()

{

return (@mysql_close($this->conn));

}

function error()

{

return (mysql_error());

}

function query($sql = '')

{

$this->result = @mysql_query($sql, $this->conn);

return ($this->result != false);

}

function affectedRows()

{

return (@mysql_affected_rows($this->conn));

}

function numRows()

{

return (@mysql_num_rows($this->result));

}

function fieldName($field)

{

return (@mysql_field_name($this->result,$field));

}

function insertID()

{

return (@mysql_insert_id($this->conn));

}

function fetchObject()

{

return (@mysql_fetch_object($this->result, MYSQL_ASSOC));

}

function fetchArray()

{

return (@mysql_fetch_array($this->result, MYSQL_NUM));

}

function fetchAssoc()

{

var $database = 'moneyau_money2';
return (@mysql_fetch_assoc($this->result));

}

function freeResult()

{

return (@mysql_free_result($this->result));

}

}

define('_BASEURL_','http://www.example.com');//protocol required (http://)

/*

define('_BASEURLCSSNEW_','http://static.css.example.com/greenfairnew');

define('_BASEURLICONS_','http://wcons.df.example.com/greenfairnew');

define('_BASEURLHOWITWORKS_','http://oi.how.it.example.com/greenfairnew');

define('_BASEURLTEMPLATEIMAGE_','http://ti.ak.img.example.com/greenfairnew');

define('_BASEURLMEDIA_','http://media.fr.example.com/greenfairnew');

define('_BASEURLMEDIAIMAGES_','http://img.zs.ch.example.com/greenfairnew');

*/

define('_BASEURLCSSNEW_','http://www.example.com/div2');

define('_BASEURLICONS_','http://www.example.com/div2');

define('_BASEURLHOWITWORKS_','http://www.example.com/div2');

define('_BASEURLTEMPLATEIMAGE_','http://www.example.com/div2');

define('_BASEURLMEDIA_','http://www.example.com/div2');

define('_BASEURLMEDIAIMAGES_','http://www.example.com/div2');

define('_BASEPATH_','/home/moneyau/public_html');

define('_IMAGESURL_',_BASEURL_.'/images');

define('_IMAGESPATH_',_BASEPATH_.'/images');

define('_IMAGESURLM_',_BASEURL_.'notesimages');

define('_IMAGESPATHM_',_BASEPATH_.'notesimages');

define('_ADMIN_MAIL_','info@example.com');

define('_TITLE_','Money Auctions ¦ ');

define('_TITLE1_','Money Auctions ');

$accepted_upload_extensions_pics = array('gif','jpg','jpeg','png');

function get_uname($uid){

$sql="select * from user where id='$uid'";

$myrwd=mysql_query($sql);

$myuname=mysql_fetch_array($myrwd);

$uname=$myuname['uname'];

return $uname;

}

?>

[edited by: eelixduppy at 3:14 am (utc) on Aug. 7, 2009]
[edit reason] removed specifics [/edit]

dreamcatcher

8:49 am on Aug 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi BrandNew,

Welcome to WebmasterWorld. :)

Its not good practice to have underscores in constants, so try removing those. These lines are the cause of your problem:

define('_IMAGESURL_',_BASEURL_.'/images');
define('_IMAGESPATH_',_BASEPATH_.'/images');
define('_IMAGESURLM_',_BASEURL_.'notesimages');
define('_IMAGESPATHM_',_BASEPATH_.'notesimages');

Nuke all the underscores from the constants and you should be good to go.

dc