Using same query again inside while loop in PHP
Using same query again inside while loop in PHP
The mysqli_data_seek() function adjusts the result pointer to an arbitrary row in the result-set.
<?php
$con = mysqli_connect('127.0.0.1','root','pinturp1','test');
$sql = "Select * from test.keywords limit 20";
$resultQuery = mysqli_query($con,$sql);
while($queryrow = mysqli_fetch_array($resultQuery))
{
echo $queryrow['keyword']."<br>";
}
echo "<br>-------------------------------------------<br>";
mysqli_data_seek($resultQuery, 0);
while($queryrow = mysqli_fetch_array($resultQuery))
{
echo $queryrow['keyword']."<br>";
}
echo "<br>-------------------------------------------<br>";
mysqli_data_seek($resultQuery, 0);
while($queryrow = mysqli_fetch_array($resultQuery))
{
echo $queryrow['keyword']."<br>";
}
?>
The mysqli_data_seek() function adjusts the result pointer to an arbitrary row in the result-set.
<?php
$con = mysqli_connect('127.0.0.1','root','pinturp1','test');
$sql = "Select * from test.keywords limit 20";
$resultQuery = mysqli_query($con,$sql);
while($queryrow = mysqli_fetch_array($resultQuery))
{
echo $queryrow['keyword']."<br>";
}
echo "<br>-------------------------------------------<br>";
mysqli_data_seek($resultQuery, 0);
while($queryrow = mysqli_fetch_array($resultQuery))
{
echo $queryrow['keyword']."<br>";
}
echo "<br>-------------------------------------------<br>";
mysqli_data_seek($resultQuery, 0);
while($queryrow = mysqli_fetch_array($resultQuery))
{
echo $queryrow['keyword']."<br>";
}
?>
Comments
Post a Comment