When I'm using XAMPP localhost my system is working but when I upload it in cpanel other page not working. other page is working like login but in view and edit page it gets error.
I got this error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1044] Access denied for
other page:
Connection failed: SQLSTATE[HY000] [1044] Access denied for user
my connection:
<?php
$db_host = 'localhost';
$db_user = 'xxx';
$db_pass = 'xxx';
$db_database = 'xxx';
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
if I changed the connection approach
<?php
mysql_connect("localhost", "xx", "xx") or die(mysql_error());
mysql_select_db("xx") or die(mysql_error());
?>
I got this error:
Fatal error: Call to a member function prepare() on a non-object in