To query a MariaDB - MariaDB is a fork of MySQL - database using PHP, code similar to that shown below can be used. In this exmple, the account used to query the database is
johndoe
with a password of ThePassword
. The database is named
Acme
and contains a table named Accounts
.<?php $con = mysql_connect("localhost","johndoe","ThePassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Acme", $con); $accounts = mysql_query("SELECT * FROM Accounts"); ?>
[ More Info ]