I am running XAMPP for Windows 8.1.12 under windows 11.
Just trying to do a first connection.
I have used phpmyadmin to create a database.
I run the script below and I get this result on my browser
Parse error: syntax error, unexpected single-quoted string “root”, expecting “)” in C:\xampp\htdocs\Test.php on line 12
Line 12 is $mysqli = mysqli_connect(‘localhost’, ‘root’, ‘’, ‘ftest’);
and the xampp FAQ says “The MySQL administrator (root) has no password.”
<?php
echo "Hello";
//https://www.php.net/manual/en/mysqli.construct.php
/* You should enable error reporting for mysqli before attempting to make a connection */
//mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
error_reporting(0);
mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = mysqli_connect('localhost', 'root', '', 'ftest');
if (mysqli_connect_errno()) {
throw new RuntimeException('mysqli connection error: ' . mysqli_connect_error());
}
/* Set the desired charset after establishing a connection */
mysqli_set_charset($mysqli, 'utf8mb4');
printf("Success... %s\n", mysqli_get_host_info($mysqli));
?>