Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.
The internal data point is still at the end when you try to use your second while loop. You have done nothing to reset it.
You can move it back to the start with mysqli_data_seek($result, 0);
Update:
when first while loop run the internal data pointer move ahead and reach the last data pointer . so while your trying to get data from that using second while loop . so there is no more data because .it’s already reach last data pointer .
6
solved mysqli calling same data twice [duplicate]