I'm trying to display generated data from PHPMyAdmin into a table using MySQLi and I can't seem to figure it out.
<tr>
<th scope="col">Link</th>
<th scope="col">Category</th>
</tr>
<?php
//Connection Information
$connection = mysqli_connect('localhost','root',''); //establish connection to db
$selected = mysqli_select_db($connection, 'sample'); //select db
//SQLi Statements
$viewQuery = "select * from link JOIN categories";
$execute = mysqli_query($connection,$viewQuery);
if($execute)
{
while($row = mysqli_fetch_array($execute))
{
$link = $row['link'];
$category = $row['category'];
}
}
?>
<tr>
<td><?php echo $link; ?></td>
<td><?php echo $category; ?></td>
</tr>
</table>
Is there something I'm missing? I'm new to MySQLi
question from:
https://stackoverflow.com/questions/65838391/mysqli-displaying-results-in-a-table 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…