Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION
Results 1 to 5 of 5

Thread: Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION

  1. #1
    Member
    Join Date
    Sep 2006
    Posts
    28

    Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION

    i keep running into this and been working on it for 2 months and still can't figure it out

    Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/under/public_html/kp/includes/inc-setup.php on line 16

    PHP Code:
    <?php

    //include( $incloc . "includes/inc-config.php" );

    class mysql {
        function 
    connect()
        {
            
    //global $DB_INFO;
    define('DB_NAME''under_rebels');
            
    $connect mysql_connect("localhost""under_nocause""buttercream");
            
    mysql_select_db(DB_NAME$connect);
            if ( !
    $connect ) {
                die(
    "Cannot connect to mySQL Host.");
            }  
        } 
    $query = ('SELECT * FROM DB_NAME');
    $results mysql_query($query) or die('Query failed: ' mysql_error());

        function 
    query$results )
        {
            return 
    mysql_query$results );
        } 

        function 
    fetch$results )
        {
            return 
    mysql_fetch_array$results );
        } 

        function 
    num$results )
        {
            return 
    mysql_num_rows$results );
        } 
        function 
    affected()
        {
            return 
    mysql_affected_rows();
        } 
        function 
    close()
        {
            return 
    mysql_close();
        } 


    $db = new mysql;
    $db->connect();

    $mintime15 time() - ( 60 15 );
    $timeminus24 time() - ( 60 60 24 );

    $gamedate date"d-m-Y - H:i:s" );

    $result $db->query"SELECT * FROM settings" );
    while ( 
    $rowz $db->fetch$result ) ) {
        
    $x1 $rowz['sName'];
        
    $x2 $rowz['sValue'];
        
    $SETTINGS[$x1] = $x2;


    ?>
    line 16:
    PHP Code:
    $query = ('SELECT * FROM DB_NAME'); 

  2. #2
    Member
    Join Date
    Aug 2004
    Posts
    3,021
    Your class construction is wrong. You can't put statements outside of functions in a class declaration, only variable declarations.

  3. #3
    Member
    Join Date
    Sep 2006
    Posts
    28
    ummm...........english plz i am not that good with php

  4. #4
    addicted thorpe's Avatar
    Join Date
    Aug 2004
    Location
    sydney
    Posts
    3,457
    That is English. If your not good with php you need to learn it not English. Read this.

  5. #5
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Running Gear"
    Posts
    22,573
    Code:
    >php -r "Your class construction is wrong. You can't put statements outside of functions in a class declaration, only variable declarations."
    
    Parse error: parse error, unexpected T_CLASS in Command line code on line 1
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

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
  •