MYSQLI Connection String

<?Php
$host = "localhost";
$database = "sql_tutorial";// Change your database name
$username = "userid";      // Your database user id 
$password = "";      // Your password

//error_reporting(0);// With this no error reporting will be there
///// Do not Edit below //////
$connection=mysqli_connect($host,$username,$password,$database);
if (!$connection) {
    echo "Error: Unable to connect to MySQL.<br>";
    echo "<br>Debugging errno: " . mysqli_connect_errno();
    echo "<br>Debugging error: " . mysqli_connect_error();
    exit;
}
?>
We will use $connection variable in our script to access our database.

Google Cloud & MySQL connection using MySQLi

<?Php
$host = "34.68.103.244";
$database = "my_tutorial";       // Change your database name
$username = "root-plus2net";     // Your database user id 
$password = "*********";         // Your password

//error_reporting(0);// With this no error reporting will be there
///// Do not Edit below //////
$connection=mysqli_connect($host,$username,$password,$database);
if (!$connection) {
    echo "Error: Unable to connect to MySQL.<br>";
    echo "<br>Debugging errno: " . mysqli_connect_errno();
    echo "<br>Debugging error: " . mysqli_connect_error();
    exit;
}
//////Sample script to display record ///


$q="SELECT * FROM student WHERE id=3";
// Generate resultset
$result_set = $connection->query($q);
$row=$result_set->fetch_array(MYSQLI_NUM);
echo $row[0],$row[1],$row[2],$row[3];
$result->free;

?>
Details of MySQL database setup
More on Managing MySQL database at Google cloud
MYSQLI Functions MySQLI Installation


plus2net.com







Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer