session_start();
include 'assets/config.php';
if(isset($_POST['username'])){
$queryIsUsername = ("SELECT count(user) FROM users WHERE user = '$_POST['username']'"); //Error
$actionQueryIsUsername = mysql_query($queryIsUsername);
while($rowIsUsername = mysql_fetch_array($actionQueryIsUsername)) {
$isUsername[] = $rowIsUsername['COUNT(user)'];
}
if($isUsername[0]="0"){
header("Location: login.php?error=e1");
}
else{
//do stuff
}
我不確定最新錯誤,這是我的錯誤。我刪除了if語句,錯誤消失了。PHP SQL語法錯誤?
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /Applications/XAMPP/xamppfiles/htdocs/craftlist/index.php on line 7
爲什麼你圍繞在括號中的查詢字符串? – 2013-05-08 23:48:31
這是我拾起的一個小習慣。 – OPatel 2013-05-08 23:49:54