View Single Post
Old 09-08-2021, 02:27 AM  
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
Quote:
Originally Posted by Publisher Bucks View Post
K33n,

I gave that a try and its still showing a blank page, this is the error from the logs:
function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$host;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

dbcreds file:
<?php
$dbname='dbname';
$dbuser='dbusername';
$dbpass='dbpassword';
$dbhost='localhost';
?>

These two don't match, that's why you're getting a blank page (as no database connection is being made).


Change the function to:

function hookitup()
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf8" ,$user,$password,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}

And as K33n noted, change:

$stmt = $db->prepare($sql_str);

to:

$stmt = $db->prepare($sql);
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote