wtfsmd Posted January 7, 2007 Share Posted January 7, 2007 Hey i have the following error, and i have searched over the code in the area and nothing caught my eye.Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/t/i/m/timeba/html/newsite/login1.php on line 42Here is the code from line 35 - 45[code] $check = $db_object->query("SELECT username, password FROM users WHERE username = '".$_POST['uname']."'"); $sql = "SELECT username, password FROM users WHERE username = '".$_POST['uname']."'; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $_SESSION['rank'] = $row['userrank']; } if (DB::isError($check) || $check->numRows() == 0) {[/code]Thanks, wtfsmd Link to comment https://forums.phpfreaks.com/topic/33186-solved-parse-error/ Share on other sites More sharing options...
kenrbnsn Posted January 7, 2007 Share Posted January 7, 2007 You're missing the closing double quote before the semi-colon on this line:[code]<?php$sql = "SELECT username, password FROM users WHERE username = '".$_POST['uname']."';?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/33186-solved-parse-error/#findComment-154880 Share on other sites More sharing options...
DarkendSoul Posted January 7, 2007 Share Posted January 7, 2007 Just to help you out with quotes and the such, you could phrase variables in 2 other ways...Without single quotes. Example:$sql = "SELECT username, password FROM users WHERE username = '$_POST[uname]'";With huggie brackets. Example:$sql = "SELECT username, password FROM users WHERE username = '{$_POST['uname']}'"; Link to comment https://forums.phpfreaks.com/topic/33186-solved-parse-error/#findComment-154883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.