View Single Post
Old 09-08-2021, 10:02 AM  
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Quote:
Originally Posted by sarettah View Post
indicates that you are not passing in a username or password. The places that say NULL, NULL right before the Array indicate that $dbuser and $dbpass are coming in as NULL meaning there ain't nothing there.
Okay, I think it has something to do with this part at the bottom of the coding (my version)...

Quote:
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8" ,$username,$password,array(PDO::ATTR_EMULATE_PREPA RES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
So, if you are using the dbcreds.php file then the problem is in there. If you are not using that and have the user and password hardcoded then that would be where the issue is.

This is the dbcreds.php file that is being used:

Quote:
$dbname='database';
$dbuser='user';
$dbpass='password';
$dbhost='localhost'
Am I right in assuming the above code should look like this on the bottom of recipesnew.php:

Quote:
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf 8" ,$dbuser;$dbpass,array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
Because I tried changing the dbpassword part and it still shows a blank page, I know 100% the information in the dbcreds.php is correct and there was a mismatch of the naming, which I (think) I corrected? Or does that entire string need to be included in quotation marks like this...

Quote:
{
require_once('dbcreds.php');
return new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf8;$d buser;$dbpass",array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
I think I'm confusing myself with the edits somewhere in this specific section
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote