[RESOLVED] Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTIO
Results 1 to 5 of 5

Thread: [RESOLVED] Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTIO

  1. #1
    Member
    Join Date
    May 2009
    Location
    Pretoria, South Africa
    Posts
    44

    resolved [RESOLVED] Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTIO

    Hello guys.

    I see there is a few threads on this subject but i have this problem the code looks ok to me but i'm not really up to scratch with functions or classes. this is the error...

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/site/public_html/pfp/magazine/db.php on line 6



    here is the code.

    config.php
    PHP Code:
    <?php

    // ADMIN SETTINGS //
    define ("ADMIN_PASSWORD""PASS");                    //  Admin Password
    define ("WEBSITE_NAME""Flash Page Flip");                    //  Your Website Name                    

    // MySQL SETTINGS //
    define ("HOST","localhost");                            //  database host
    define ("USR""user");                            //  database username
    define ("PSW""pass");                            //  database password
    define ("DB""cms");                            //  database to use

    // E-MAIL SETTINGS //
    define ("MAIL_FROM_NAME","website admin");             //  Sender Name
    define ("MAIL_SENDER_EMAIL","sender@example.com");            //  Sender E-mail
    define ("MAIL_SENDER_USERNAME","sender@example.com");        //  Sender E-mail Username
    define ("MAIL_SENDER_PASSWORD","youremailpassword");        //  Sender E-mail Password
    define ("MAIL_SERVER","mail.example.com");                //  Sender Mail Server
    define ("CHAR_SET","8859-1");                        //  Mail Character Set Code
    define ("STF_SUBJECT","Check This Out");                //  Tell a Friend Mail Subject
    define ("STF_LINK","www.example.com");            //  Your Publication Link For Tell a Friend
    define ("LOST_PASSWORD_SUBJECT","Your Login Information");    //  Lost Password Mail Subject

    ?>
    db.php

    PHP Code:
    <?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;
            } 
        }
    }
    ?>
    if comment out the private $conn line it just moves on and gives me exactly the same error on line 11.

    any insight would much appreciated!
    thanks
    Last edited by aarchaic; 06-08-2009 at 03:30 AM.

  2. #2
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,918
    What is the version of PHP that you are running this script on?
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  3. #3
    Member
    Join Date
    May 2009
    Location
    Pretoria, South Africa
    Posts
    44
    the host we using is running PHP Version 4.4.6

  4. #4
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,918
    Quote Originally Posted by aarchaic
    the host we using is running PHP Version 4.4.6
    That explains it. The private and public keywords for access control are features from PHP 5. Likewise, the constructor declaration __construct() is a PHP 5 feature.

    It may be the case that your host offers PHP 5 as an option; if so, switch to PHP 5. If not, I suggest that you demand that your host upgrade to PHP 5.2 (or later) since PHP 4 is obsolete, to the point that even major security bugs in PHP 4 will not be officially fixed (and this has been the situation for more than half a year).
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  5. #5
    Member
    Join Date
    May 2009
    Location
    Pretoria, South Africa
    Posts
    44
    THanks alot! i'll contact my host now!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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