while($row=mysql_fetch _array($run)) which loop can i use in place of while loop to fetch data from database ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

while($row=mysql_fetch _array($run)) which loop can i use in place of while loop to fetch data from database ?

23rd Dec 2016, 8:15 AM
manish
manish - avatar
5 Answers
+ 1
mysql_fetch_array() can only work with while loop. so there is no alternative loop that can be used in place of while loop.
27th Dec 2016, 3:16 AM
Raniket Ram
Raniket Ram - avatar
0
while is the correct loop to be used in this place. What is your problem with while
23rd Dec 2016, 8:21 AM
Rishi Anand
Rishi Anand - avatar
0
But this is interview question
23rd Dec 2016, 4:27 PM
manish
manish - avatar
0
No i were just saying that in place of while loop , other loop can work or not.
27th Dec 2016, 6:07 PM
manish
manish - avatar
0
while($data = $sql->fetch(PDO::FETCH_OBJ){ $data->whateverData; }
22nd Jan 2017, 9:11 PM
Phiri TP
Phiri TP - avatar