以下代码运行结果为( )$conn = mysqli_connect('localhost','root','root','test');$result = mysqli_query($conn,'select * from user');$data = mysqli_fetch_array($result);
A: 变量data保存了user表所有数据
B: 变量data保存了user表1条数据
C: 变量data保存了user表的2条数据
D: 变量data保存了user表的3条数据
A: 变量data保存了user表所有数据
B: 变量data保存了user表1条数据
C: 变量data保存了user表的2条数据
D: 变量data保存了user表的3条数据
举一反三
- 以下程序输出结果为( )$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表最后一条数据
- 有以下程序代码,能正确输出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]
- 有以下程序代码,其中能输出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']
- 以下程序代码实现的功能是( )$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 id,name,sex from user where id=1');$data = mysqli_fetch_array($result);echo $data[0]; A: 1 B: 2 C: 0 D: 空值