<?php
$dbc=mysqli_connect('localhost','root','','sam_telephone');
$query="SELECT * FROM master_name";
$result= mysqli_query($dbc,$query);
$display=mysqli_fetch_array($result);
echo $display['f_name']; /// its show me the result which is fine
// but when i apply while loop it does not show any thing.
while($y = mysqli_fetch_array($result)){
echo $y['f_name'];
}
// $y['f_name'] should give me a result becuase it showing me the result on line
10 why its not working on this line i dont know
?>
arifkutty
0
Newbie Poster
Recommended Answers
Jump to PostAre you sure that there is more than one result being returned?
Jump to Post^^ By the second mysqli_fetch call the pointer is on the second record, so if only one record is returned, the second call will be empty. I think.
All 6 Replies
Assembly Guy
72
Posting Whiz
diafol
arifkutty
0
Newbie Poster
IIM
163
Master Poster
diafol
arifkutty
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.