报这个错
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/users/jinriminhang.com/Reader/db.php on line 5
贴下php的源码<?php
require_once("config.php");class db_layer
{
private $conn;
function __construct()
{
} public function getConnection()
{
if($this->conn == "")
{
$conn = mysql_connect(HOST,USR,PSW);
mysql_select_db(DB);
mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci';");
$this->conn = $conn;
}
return($conn);
}
public function execute_sql($arg_sql,&$arg_result,&$arg_error_msg)
{
$arg_sql = str_replace(';', ':', $arg_sql);
$this->getConnection();
if (!($arg_result = mysql_query($arg_sql)))
{
$arg_error_msg = "There was a problem With the Database".NL."Error : ".mysql_error().NL.NL;
$arg_error_msg .= "SQL = [".$arg_sql."]";
echo $arg_sql1= $arg_sql." ### ".mysql_error();
return FALSE;
}
else
{
return TRUE;
}
}
}
?>各位大侠帮我看看是怎么回事好不?我本地的是没问题的,传到服务器上就不行了
本地masql5.0
服务器4.1
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/users/jinriminhang.com/Reader/db.php on line 5
贴下php的源码<?php
require_once("config.php");class db_layer
{
private $conn;
function __construct()
{
} public function getConnection()
{
if($this->conn == "")
{
$conn = mysql_connect(HOST,USR,PSW);
mysql_select_db(DB);
mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci';");
$this->conn = $conn;
}
return($conn);
}
public function execute_sql($arg_sql,&$arg_result,&$arg_error_msg)
{
$arg_sql = str_replace(';', ':', $arg_sql);
$this->getConnection();
if (!($arg_result = mysql_query($arg_sql)))
{
$arg_error_msg = "There was a problem With the Database".NL."Error : ".mysql_error().NL.NL;
$arg_error_msg .= "SQL = [".$arg_sql."]";
echo $arg_sql1= $arg_sql." ### ".mysql_error();
return FALSE;
}
else
{
return TRUE;
}
}
}
?>各位大侠帮我看看是怎么回事好不?我本地的是没问题的,传到服务器上就不行了
本地masql5.0
服务器4.1
解决方案 »
- 将数字1000000变成1,000,000
- 200分向了解phpwind的朋友求两条sql语句
- php中$_session['userid']的问题
- [网站外包]简单的多用户商品展示,价格1000左右
- 想把秒数传换成时间,有没有好一些的方法或者函数?
- 我这写了一段域名查询的程序,可是出了问题,请大家指点一下!!在线等
- 大家好,realserver的总是
- php怎么只有建库函数,没有建表函数?
- 一个小问题,请帮我区别一下,windows.location和form.action
- JAVASCRIPT里创建的数组里的值传到PHP里到服务器执行
- 数据库里查询出来的数据循环放到表单里面,如何传递到下个页面?
- Linux下有集成开发环境软件包吗?
/www/users/jinriminhang.com/Reader/db.php文件中的代码?
<?php// ADMIN SETTINGS //
define ("ADMIN_PASSWORD", "000000"); // Admin Password
define ("WEBSITE_NAME", "今日民航电子杂志"); // Your Website Name // MySQL SETTINGS //
define ("HOST","localhost"); // database host
define ("USR", "magazine_f "); // database username
define ("PSW", "000000"); // database password
define ("DB", "magazine"); // database to use
?>这是config的代码
如果不升级,试下把private $conn 改为var $conn;试试...
服务器上的是php4
如果不升级,试下把private $conn 改为var $conn;试试... 这样也不行
试着改了下兼容,可是还错误,大家帮忙看下 <?php
//require_once("config.php");
Class db_layer
{
var $conn;
var $host = 'localhost';
var $user = 'magazine_f';
var $psw = '000000';
var $db = 'magazine';
function __construct($this->host,$this->user,$this->psw,$this->db)
{
$this->getConnection($this->host,$this->user,$this->psw,$this->db);
} function getConnection($this->host,$this->user,$this->psw,$this->db)
{
if($this->conn == "")
{
$conn = mysql_connect($this->host,$this->user,$this->psw);
mysql_select_db($this->db);
mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci';");
$this->conn = $conn;
}
return($conn);
}
function execute_sql($arg_sql,&$arg_result,&$arg_error_msg)
{
$arg_sql = str_replace(';', ':', $arg_sql);
$this->getConnection();
if (!($arg_result = mysql_query($arg_sql)))
{
$arg_error_msg = "There was a problem With the Database".NL."Error : ".mysql_error().NL.NL;
$arg_error_msg .= "SQL = [".$arg_sql."]";
echo $arg_sql1= $arg_sql." ### ".mysql_error();
return FALSE;
}
else
{
return TRUE;
}
}
}
?>
报错提示
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in /www/users/jinriminhang.com/Reader/db.php on line 10