This mysql connection and query IS working in my __global.php hook file:
Code: Select all
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("databasename") or die(mysql_error());
mysql_query( "INSERT INTO etc, etc, etc...") or die(mysql_error());
Code: Select all
$db = new mysqli('localhost', 'username', 'password', 'databasename');
if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');
}
mysqli_query($db, "INSERT INTO etc, ec, etc...") or die('Unable to connect to database [' . $db->connect_error . ']');
Can anyone help me with I'm dong wrong please? Am I missing something?
Even better still, I'd like to update to a PDO connection. Is that possible with Appgini 5.40 and assuming it is,what's required to get the connection working? Thanks.