Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "syntax error, unexpected $end" how to fix this error?

    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);
    }
    }
    ?>

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post
    PHP Code:
    <?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..

  • #3
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    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.
    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog

  • #4
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by syncupsolutions View Post
    PHP Code:
    <?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?

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Change
    PHP Code:
    $this->sql = new com(`adodb.connection); 
    to
    PHP Code:
    $this->sql = new com('adodb.connection'); 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Change
    PHP Code:
    $this->sql = new com(`adodb.connection); 
    to
    PHP Code:
    $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

  • #7
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Warning: com() has been disabled for security reasons
    You'd need to contact your host support team.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #8
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    Yes, I hear that's a COMmon problem. *chuckle*
    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •