Relative Content

Tag Archive for phppdo

Undefined constant PDO::ATTR_ERRMODE_EXCEPTION

<?php $dsn = “mysql:host=localhost;dbname=itemiq”; $dbusername = “root”; $dbpassword = “”; try { $pdo = new PDO($dsn, $dbusername, $dbpassword); $pdo->setattribute(PDO::ATTR_ERRMODE, PDO::ATTR_ERRMODE_EXCEPTION); } catch (PDOException $e) { echo “Connection failed: ” .$e->getMessage(); } Trying to insert data for a login system using PDO. For some reason, I am stuck with this error saying ‘Undefined class constant PDO::ATTR_ERRMODE_EXCEPTION. […]