[英]mysql_fetch_assoc in MeekroDB
Excuse me for being new to MeekroDB library, I wonder how to check for rows in the login process; 对不起,我是MeekroDB库的新手,我想知道如何在登录过程中检查行;
$query = DB::query("SELECT * FROM users WHERE username=%s",$username);
$numrows = DB::count($query);
// this needs the edit
if ($numrows!=0){
while($row = mysql_fetch_assoc($query)){
$dbusername = $row['username'];
$dbpassword = $row['password'];}
You need to bear in mind that your variable $query is now an array (if any records are found) so you do not need to do 您需要记住,变量$ query现在是一个数组(如果找到任何记录),因此您无需执行
while($row = mysql_fetch_assoc($query))
Instead try 试一试
foreach ($query as $user)
{
$dbusername = $user['username'];
$dbpassword = $user['password'];
}
Also, if you have more then one record with the same username and password then you may be doing something wrong with your user registration/maintenance process. 另外,如果您有多条具有相同用户名和密码的记录,则可能是用户注册/维护过程做错了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.