有以下程序代码,其中能输出name的是( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select id,name,sex from user where id=1');$data = mysqli_fetch_row($result);
A: $data[1]
B: $data[0]
C: $data->name
D: $data['name']
A: $data[1]
B: $data[0]
C: $data->name
D: $data['name']
举一反三
- 有以下程序代码,能正确输出id值的是( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select id,name from user');$data = mysqli_fetch_array($result,MYSQLI_NUM); A: $data['id'] B: $data['name'] C: $data[0] D: $data[1]
- 以下程序代码的输出结果为( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select id,name,sex from user where id=1');$data = mysqli_fetch_array($result);echo $data[0]; A: 1 B: 2 C: 0 D: 空值
- 以下程序代码实现的功能是( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select id,name from user');$data = mysqli_fetch_all($result,MYSQLI_ASSOC);foreach ($data as $v){ if($v['id'] == 5){ echo $v['name']; }} A: 输出所用用户的name B: 输出第一位用户的name C: 输出id=5的用户的name D: 输出id不为5的用户的name
- 以下程序代码实现的功能是( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select * from user');while ($data=mysqli_fetch_array($result)){ echo $data['id'].$data['name'].'<br/>';} A: 输出user表所有用户id和name B: 输出user表第一位用户id和name C: 输出user表最后一位用户id和name D: 输出报错
- 以下程序输出结果为( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select * from user');$data = mysqli_num_rows($result);echo $data A: 输出user表所有记录 B: 输出user表记录总数 C: 输出user表第一条数据 D: 输出user表最后一条数据