Talal Abderrazzak Posted October 2, 2015 Share Posted October 2, 2015 Hi guys, I'm trying to insert a php code in one of my tpl files, in this code there is some sql queries This is my code : {php} try { $conn= new PDO("mysql:dbname=dev;host=localhost" , "dev", "my_password" ,array(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION)); $find_counts = null; $find_counts = $conn->query('SELECT counts FROM fz_customer'); echo '<br>DEBUT WHILE'; //cas d'un retour vide if (!is_null($find_counts) && $find_counts !== FALSE) { $row = $find_counts->fetch(); } echo '<br>Cette page a été vue : '.$row['counts']; $update_count = "UPDATE fz_customer SET counts= counts + 1"; $stmt = $conn->prepare($update_count); if (!$stmt->execute()) { echo '<br>ERREUR'; throw PDOException('ERREUR PDO TUTU',100); } else { echo '<br>Compteur modifie'; } echo '<br>FIN WHILE'; } catch(PDOException $pdoE) { //CATCH ERREURS PDO die('Erreur:' .$pdoE->getMessage()); } catch(Exception $e) { //CATCH TOUTE ERREURS die('Erreur:' .$e->getMessage()); } {/php} When I refresh the web page this error display: Erreur:SQLSTATE[28000] [1045] Access denied for user 'dev'@'localhost' (using password: YES) How can I solve this? Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now