2013-10-05 91 views
0

您好我是PHP新手,我遇到了bind_param问题。我一直在努力几个小时,但没有运气。在更新PHP bind_param()时遇到问题

这里是我的代码:

$username="username"; 
    $stmt = $mysqli->prepare("SELECT AdminID#, UserName, Password, Salt FROM AdminMembers WHERE UserName = ? LIMIT 1"); 
    $stmt->bind_param('s', $username); // Bind "$username" to parameter. 
    $stmt->execute(); // Execute the prepared query. 
    $stmt->store_result(); 
    $stmt->bind_result($user_id, $username, $db_password, $salt); 


    echo $user_id; 
    echo "<br>"; 
    echo $username; 
    echo "<br>"; 
    echo $db_password; 
    echo "<br>"; 
    echo $salt; 

我得到一个空白屏幕。

任何人都可以看到我的代码有问题吗?

+0

你有一个错误在您的SQL查询 – underscore

+0

这是什么AdminID# – underscore

+0

任何错误?使用['$ stmt-> error'](http://www.php.net/manual/pt_BR/mysqli-stmt.error.php)或['$ stmt-> error_list'](http:// www。 php.net/manual/pt_BR/mysqli-stmt.error-list.php),请在屏幕上打印并向我们展示。 –

回答

0

使用反引号

SELECT `AdminID#`, `UserName`, `Password`, `Salt` FROM AdminMembers WHERE UserName = ? LIMIT 1