我得到一个未定义的变量$ ar,$ pr和$ af。
$sql = mysqli_query($connection, "Select empno, username, password, access_level from personaltab where access_level='ADMIN'");
$cnt = mysqli_num_rows($sql);
$i=0;
while ($r=mysqli_fetch_array($sql)){
$md = md5($r['username']."!@#$%^&*()_+|");
$ar .= $md.", ";
$mdp = md5($r['password']."|+_)(*&^%$#@!<>?:{}[]=-");
$pr .= $mdp.", ";
$af .= $r['empno'].", ";
}
答案 0 :(得分:0)
您需要在循环之前初始化变量。否则,没有连接的初始值。
$ar = '';
$pr = '';
$af = '';
while ($r = mysqli_fetch_array($sql)) {
...
}