I have this code. What this code do is it will display query output at the top and bottom. Query execution is at bottom.
<span><?php echo mysqli_num_rows($result) ?></span>
//my other code here
//query database
$result = mysqli_query($con, "SELECT brand, url,...
while ($row = mysqli_fetch_array($result)) {
echo $row['brand'];
echo $row['url'];
}
I have few constraint which is I cannot put my query at the top and multiple select
query. How do you suggest I solve this problem? Thank you.
You cant call mysqli_num_rows unless you query database.
But for your solution, Ir you want to show number of records on the top of page?
You can call query before you print mysqli_num_rows and then recall when needed at bottom like displayed here:
<?php //query database
$result1 = mysqli_query($con, "SELECT brand, url,... ?>
<span><?php echo mysqli_num_rows($result1) ?></span>
//my other code here
//query database
$result = mysqli_query($con, "SELECT brand, url,...
while ($row = mysqli_fetch_array($result)) {
echo $row['brand'];
echo $row['url'];
}