I have some custom pages that I have moved the variables from the .php file into a database.
I've tested the database connection on its own and everything works fine. But as soon as I add the database code to the vB custom page the page no longer renders (just shows a blank page).
Here is a sample of the database code I've tried to insert into the custom page:
Code:
// Get parameters from url query string
$db = new dbPDO();
$cruiseport_id = !empty($_GET['id'])?intval($_GET['id']):1;
// get all the values form your table limited to the first matching row (thre should only be one
$query = "SELECT * FROM cruiseports WHERE cruiseport_id = :cruiseportid limit 1";
// the prepare and bind methods prevent any sort of SQL injection (ie bad stuff in the $id value)
$stmt = $db->prepare($query);
$stmt->bindValue(":cruiseportid",$cruiseport_id);
$stmt->execute();
// we are only expecting 1 row here...
$port = $stmt->fetch(PDO::FETCH_ASSOC);
Like I said the code on its own returns the results without issue but in a vB custom page .php it stops the page from rendering at all (just blank). But no errors are produced.