Tuesday, September 29, 2015

[google-cloud-sql-discuss] is this a right script to connect cloud sql with php

i am unable to connect my cloud sql with my php script. scirpt is as follow:-


<?php  
//Create the connection
$con = new mysqli(':/cloudsql/testingscript3:dbin',
  'root', // username
  '',     // password
  'secure_login',
  ); 

// Write query

$strSQL = "INSERT INTO newsfeed (News) VALUES ('hghhgjjhjj')";

// Execute the query.

$query = mysqli_query($con, $strSQL);
if ($query)
{
echo "query is executed";
}

// Close the connection
mysqli_close($con);
?>

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/1ff29c26-c3ff-473b-a36a-0d17f9044388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment