Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Adrian Saycon
3,771 PointsPDO trouble on live webserver
Everything works fine on localhost but when I uploaded everything on my web host server, the page that calls out the function doesn't display anything and doesn't show any errors even after declaring: ini_set('error_reporting', E_ALL ); ini_set('display_errors', true );
===========function that caused the page not to display============
function getAllProjects() {
try {
$db = new PDO('mysql:host='.db_host.';dbname='. db_name, db_user, db_pswd);
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$db->exec("SET NAMES 'utf8'");
} catch (Exception $e) {
echo 'There is a problem with the database.';
exit;
}
$result = $db->query("SELECT * FROM `projects`");
$proj = $result->fetchAll(PDO::FETCH_ASSOC);
return $proj;
}
Please help..
1 Answer
Michael Nguyen
6,138 PointsCheck your PHP error log then post it here. PHP Error Log Location