I tried searching but didn't find a good answer to my question. I have the following code for a loop:
<?php
$i=0;
while ($i < $num) {
$f0=mysql_result($sql,$i,"id");
$f1=mysql_result($sql,$i,"title");
$f2=mysql_result($sql,$i,"post");
?>
<p><?php echo $f1; ?></p>
<p><?php echo $f2; ?></p>
<p>Categories:</p>
<?php
$i++;
}
?>
<?php
$i=0;
while ($i < $num1) {
$f3=mysql_result($sql1,$i,"category");
?>
<?php echo $f3; ?>
<a href="edit.php?id=<?php echo $f0; ?>"><button>Edit</button></a>
<?php
$i++;
}
?>
The problem is that it is only looping up to <p>Categories</p>. It does not loop the categories and edit part which is the $f3 variable and Edit button. The categories table is a separate table so I had set up a different query ($sql1) than the posts table. How can I include those parts into the loop so they show for each post? I tried moving the $i++ part to the bottom but that just showed me the same post infinitely. Thank you for your help.