php - Parse error: syntax error, unexpected '$_POST' (T_VARIABLE) error and i just cant understand why? -
I am trying to write this simple class in php as follows:
Lt;? Php session_start (); 'Db_con.php' is required; Class logging {private $ db; Private $ username = $ _POST ['usr_name']; Private $ password = $ _POST ['usr_pass']; Personal $ query = "SELECT * by user WHERE nick = '$ user name'"; Function __ conversion () {$ this- & gt; Db = new db (); } Function loggIn () {$ res = $ this- & gt; Db- & gt; Fetch ($ query) foreach ($ res as $ line) {$ dbusername = $ row ['nick']; $ Dbpassword = $ line ['pass']; } If ($ user name == $ dbusername & amp; $ password == $ dbpassword] {$ _SESSION ['username'] = $ dbusername; Header ('location: index.php'); } Hold (exception $ E) {echo'wrong login information! '}}} Function loggOut () {session_destroy (); }}? & Gt;
But I am getting the following error: Parse error: Syntax error, unexpected '$ _POST' (T_VARIABLE) and I just can not understand why! Even if I delete these lines:
private $ username = $ _POST ['usr_name']; Private $ password = $ _POST ['usr_pass'];
I get the following error instead:
(!) Parse error: syntax error, unexpected '' 'in
im Something a real simple, but I am not able to understand it ..! Any help appriciated! In addition to syntax errors on the line
Comments
Post a Comment