Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

unexplainable PHP error

Zen

Custom Title Activated
Loyal Member
Joined
Dec 2, 2006
Messages
1,621
Reaction score
152
okay, well im working on a really basic CMS system, and the file containing my database connection class is throwing an error i cant explain.

heres the code
PHP:
<?php

require_once 'constants.php';

class mysql {
    private $conn
    
    function __construct() { 
        $this->conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME) or die('Your connection poop itself');
    }
    
    function verify_username_pass($un, $pwd) {
        
        
        $query = "SELECT * FROM users WHERE username = ? AND password = ? LIMIT 1";
        
        if($stmt = $this->conn->prepare($query)) {
            $stmt->bind_param('ss', $un, $pwd);
            $stmt->execute();
            
            if($stmt->fetch()) {
                $stmt->close();
                return true;
            }
        }
    
    
}
?>

heres the error
Code:
[B]Parse error[/B]:  syntax error, unexpected T_FUNCTION, expecting ','  or ';' in [B]C:\xampp\htdocs\login\mysql.php[/B] on line [B]8[/B]


anyone have any insight?


much appreciated.



Zen
 
Divine Celestial
Loyal Member
Joined
Feb 11, 2006
Messages
890
Reaction score
0
PHP:
private $conn

make it
PHP:
    private $conn;

You're also missing an } towards the end so:

PHP:
            }
        }
    
    
}
?>

needs to become:

PHP:
            }
        }
    }
    
}
?>

:)

- Kyle
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
Doesn't zend or emacs tell you if you have a syntax error?

I know the new VC++ does for C++ and it's quite handy to catch those misspells, missing semicolons, and missing brackets now :).
 
Junior Spellweaver
Joined
Aug 15, 2007
Messages
111
Reaction score
0
merlin, thats completely irrelevant to php...?
 
Junior Spellweaver
Joined
Aug 15, 2007
Messages
111
Reaction score
0
Was talking about the latter part about your post, about C++ compiling, but I got the context now. As I haven't slept yet you'll have to forgive me on not picking up on context clues :S
 

Zen

Custom Title Activated
Loyal Member
Joined
Dec 2, 2006
Messages
1,621
Reaction score
152
Doesn't zend or emacs tell you if you have a syntax error?

I know the new VC++ does for C++ and it's quite handy to catch those misspells, missing semicolons, and missing brackets now :).
i happened to be using *yuck* dreamweaver at the time (normally netbeans is my IDE of choice)

Was talking about the latter part about your post, about C++ compiling, but I got the context now. As I haven't slept yet you'll have to forgive me on not picking up on context clues :S
merlin is cool kthxbai.
 
Back
Top