Difference between revisions of "PHP:Databases"

From wiki
Jump to: navigation, search
(Created page with "Category:PHP ;$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport) or die ('Error connecting to mysql'); :Open database connection ;$result = mysqli_query($...")
(No difference)

Revision as of 10:03, 10 June 2019

$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport) or die ('Error connecting to mysql');
Open database connection
$result = mysqli_query($conn,$query) or die('Error, retrieve failed');
Execute a query on the opened connection
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
Fetch a row as hash
$row = mysqli_fetch_array($result, MYSQLI_NUM);
Fetch a row as array