- Edited
Hi. I have been out of the programming game for some time now. I have been told by my website hosting company that they are upgrading the server from PHP4.5 to PHP7. I have been told I can’t use my mysql and to go for PDO. I have been researching this as there is a lot of code to update. What I have got so far is this...
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
define ('HOSTNAME1', '****');
define ('USERNAME1', '****');
define ('PASSWORD1', '****');
define ('DATABASE1', '****');
$host = HOSTNAME1;
$user = USERNAME1;
$pass = PASSWORD1;
$MyDB = DATABASE1;
$conn = new PDO("mysql:host=$host; dbname=$MyDB; charset=UTF8", $user, $pass, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]);
$Result = Contracts($conn);
$MyRow = $Result->fetch();
echo "Value = " . $MyRow['Venue'];
function Contracts($conn)
{
$qList = $conn->query("SELECT * FROM EC_event WHERE ID = 2");
return $qList;
}
?>