怎么了?
$query = "select name from tabl ";
if($run = mysqli_query($con,$query)){
while($row = mysqli_fetch_assoc($run)) {
echo $row['name'].'<br>';
echo $row['username'];
}
values in the name index are shown. i'm getting this error for username here is the database
答案 0 :(得分:2)
$query = "select name,username from tabl ";
你只选择&#34; name&#34;表中的字段,您需要选择&#34; name&#34; &安培; &#34;用户名&#34;从表
答案 1 :(得分:1)
您只在查询中选择名称。因此你只得到名字数组的原因。要获取用户名,请将您的查询更改为
select name,username from tabl