What is the correct syntax to output the ID and another column value from a database query in PHP?
When fetching data from a database in PHP, you can use a loop to iterate through the results and output the desired columns. To output the ID and another column value, you can access the values by their respective keys in the fetched row array. Simply echo out the values within the loop to display them on the page.
// Assuming $result contains the fetched data from the database query
while ($row = $result->fetch_assoc()) {
echo "ID: " . $row['id'] . "<br>";
echo "Other Column: " . $row['other_column'] . "<br>";
}