Good morning, I'm new to php, I need to load a complete table that is in my mysql database and show it as a table with its header and everything on my website, if you could help me, thanks?
Good morning, I'm new to php, I need to load a complete table that is in my mysql database and show it as a table with its header and everything on my website, if you could help me, thanks?
In principle, I think you should use PDO, that if you are using a php. If you use a Laravel framework, things change a bit but are easier.
In principle the example could be like this:
<?php
function getFruit($conn) {
$sql = 'SELECT name, color, calories FROM fruit ORDER BY name';
foreach ($conn->query($sql) as $row) {
print $row['name'] . "\t";
print $row['color'] . "\t";
print $row['calories'] . "\n";
}
}
?>
You can find it here , I would suggest you check the PDO documentation in the following link .
I hope I could help you.
Greetings.