...

View Full Version : "syntax error, unexpected $end" how to fix this error?



dinckey
12-04-2010, 10:15 AM
I met a problem when I convert the access database to mysql database.
Is anybody can help me to solve this problem?

Parse error: syntax error, unexpected $end in ...\pwbuilder\libs\access.class.php on line 43

the program are as follows:
<?php
/**
*
* Copyright (c) 2003-06 PHPWind.net. All rights reserved.
* Support : http://www.phpwind.net
* This software is the proprietary information of PHPWind.com.
*
*/

!defined('R_P') && exit('Forbidden!');

class access
{
var $sql = NULL;
function access($dbhost,$dbuser='',$dbpw='')
{
$this->sql = new com(`adodb.connection);
$this->sql->open("DRIVER={Microsoft Access Driver (*.mdb)};dbq=$dbhost;uid=$dbuser;pwd=$dbpw");
if(!$this->sql->state)
{
$this->sql->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$dbhost");
!$this->sql->state && $this->halt('系统无法访问数据库文件,请检查配置信息是否正确。');
}
return $this->sql;
}
function query($SQL)
{
$rs = $this->sql->Execute($SQL);
!$rs && $this->halt('SQL 执行错误',$SQL);
return $rs;
}
function close()
{
$this->sql->close();
$this->sql->Release();
}
function halt($error = '', $SQL='')
{
require_once(R_P.'libs/access_error.php');
Showmsg(sprintf($error_msg, $error, ($SQL ? $SQL : 'NULL')), true);
}
}
?>

syncupsolutions
12-04-2010, 10:48 AM
<?php
!defined('R_P') && exit('Forbidden!');

class access{
var $sql = NULL;
function access($dbhost,$dbuser='',$dbpw=''){
$this->sql = new com(adodb.connection);
$this->sql->open("DRIVER={Microsoft Access Driver (*.mdb)};dbq=$dbhost;uid=$dbuser;pwd=$dbpw");
if(!$this->sql->state){
$this->sql->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$dbhost");
!$this->sql->state && $this->halt('系统无法访问数据库文件,请检查配置信息是否正确。');
}
return $this->sql;
}
function query($SQL){
$rs = $this->sql->Execute($SQL);
!$rs && $this->halt('SQL 执行错误',$SQL);
return $rs;
}
function close(){
$this->sql->close();
$this->sql->Release();
}
function halt($error = '', $SQL=''){
require_once(R_P.'libs/access_error.php');
Showmsg(sprintf($error_msg, $error, ($SQL ? $SQL : 'NULL')), true);
}
}
?>

Try that..

Lamped
12-04-2010, 11:20 AM
Can I suggest you wrap PHP code in [ php ] tags, and try to keep some of the indenting in. My eyes were starting to bleed trying to match the brackets.

dinckey
12-04-2010, 01:16 PM
<?php
!defined('R_P') && exit('Forbidden!');

class access{
var $sql = NULL;
function access($dbhost,$dbuser='',$dbpw=''){
$this->sql = new com(adodb.connection);
$this->sql->open("DRIVER={Microsoft Access Driver (*.mdb)};dbq=$dbhost;uid=$dbuser;pwd=$dbpw");
if(!$this->sql->state){
$this->sql->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$dbhost");
!$this->sql->state && $this->halt('系统无法访问数据库文件,请检查配置信息是否正确。');
}
return $this->sql;
}
function query($SQL){
$rs = $this->sql->Execute($SQL);
!$rs && $this->halt('SQL 执行错误',$SQL);
return $rs;
}
function close(){
$this->sql->close();
$this->sql->Release();
}
function halt($error = '', $SQL=''){
require_once(R_P.'libs/access_error.php');
Showmsg(sprintf($error_msg, $error, ($SQL ? $SQL : 'NULL')), true);
}
}
?>

Try that..

have you change anything? you can't change com(`), because com() is disable.... anybody can help me?

abduraooft
12-04-2010, 02:02 PM
Change
$this->sql = new com(`adodb.connection);
to

$this->sql = new com('adodb.connection');

dinckey
12-04-2010, 02:17 PM
Change
$this->sql = new com(`adodb.connection);
to

$this->sql = new com('adodb.connection');

if I change that, the website will remind two error which are as follows:

Warning: com() has been disabled for security reasons in ...\pwbuilder\libs\access.class.php on line 17

Fatal error: Call to undefined method com:: open() in ...\pwbuilder\libs\access.class.php on line 18

abduraooft
12-04-2010, 02:53 PM
Warning: com() has been disabled for security reasons You'd need to contact your host support team.

Lamped
12-04-2010, 04:04 PM
Yes, I hear that's a COMmon problem. *chuckle*



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum