MYSQLI DataBase connect
The first line connects with your database.
host
is normally null
or "localhost"
. The other values explain themselves.
The 2 line sets the charset, to use letters such as äöü, we can as example use utf8mb4
.
The 4 line selects everything from "table", you'll have to replace table with the name of your table.
The while loop on line 7, executes the loop as long as there is another table data.
With $row[db_column]
, you can select your db column data.
$mysqli = new mysqli(host, user, password, database, port);
$mysqli->set_charset(charset);
$sql = "SELECT * FROM table";
$result = $mysqli->query($sql);
while ($row = $result->fetch_assoc()) {
echo $row[db_column];
}