[Solved] How to select a table from Mysql Database (PHP) [closed]


Although you can find this everywhere on the web.
This is the basic code to display data from your database in a table:

require ('connection_to_db.php'); 

try {

$sql = "SELECT * FROM table";
$result = $pdo -> query($sql);
$result->execute(); 
}

catch(PDOException $e) {
    echo "Something went wrong";
$e->getMessage();
exit;
}

echo "<table width="100%" border="1">";

while($row = $result -> fetch() ) {
    echo "<tr>";
    echo "<td>".$row['table']."</td>";
    echo "</tr>";
}
echo "</table>";

2

solved How to select a table from Mysql Database (PHP) [closed]