Thursday, 30 August 2018

The mysql query does not show multiple rows

my database sample is like this

database:test
table:test

id  name  password   message  active
1   test  testpass   testmsg   no
2   test2 testtest   testmsg2  no

and when i run sql query and show it in php it just gives one result. php part was,
$a=mysqli_query($con,"select name from test where active='no'");
$b=mysqli_fetch_array($a);
print_r($b);

and it showed only the first record
test

can anybody please suggest me,where I am doing wrong?

Use a while loop to iterate over all the records
$a=mysqli_query($con,"select name from test where active='no'");
while($b=mysqli_fetch_array($a))
print_r($b);

0 comments:

Post a Comment