假设有一个数据库db_shop中有一个表tb_shop,表中有5个字段,主键为id,有20条记录,id从0到19,以下代码输出结果是( )。$conn = mysqli_connect("localhost", "root", "111", "db_shop");mysqli_query($conn,"set names utf8");$result=mysqli_query($conn,"select * from tb_shop where id<;6");$nums=mysqli_num_rows($result);echo $nums;
A: 0
B: 4
C: 5
D: 6
A: 0
B: 4
C: 5
D: 6
举一反三
- 以下程序代码的输出结果为( )$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: 空值
- 有以下程序代码,能正确输出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');$data = mysqli_num_rows($result);echo $data A: 输出user表所有记录 B: 输出user表记录总数 C: 输出user表第一条数据 D: 输出user表最后一条数据
- 以下程序代码实现的功能是( )$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