hello all. still no luck. i've been at it for two days and still no relief. i'm thinking that i'm putting the execute statement in a way that's not working with my pdo. any other thoughts?
here again is the code:
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*** echo a message saying we have connected ***/
echo 'Connected to database<br />';
}catch(PDOException $e) {
echo $e->getMessage();
}
?>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$errors = [];
}
if(empty($errors)) {
// prepare sql and bind parameters
$query = "INSERT INTO details (description, temple, quantity, price)
VALUES (:description, :temple, :quantity, :price)";
}
$stmt = $dbh->prepare($query);
$stmt->bindParam(':description', $_POST['description']);
$stmt->bindParam(':temple', $_POST['temple']);
$stmt->bindParam(':quantity', $_POST['quantity']);
$stmt->bindParam(':price', $_POST['price']);
$stmt->execute(); /***line 66***/
/*** close the database connection ***/
$dbh = null;
i'm thinking that maybe i should be using $dbh instead of $stmt for the handler that binds the parameters. but it seem like that may not be the issue because the script breaks at line 66. i'm still working at it. thanks all. any ideas are greatly appreciated. i'll try almost anything at this point.
oh yeah, here is the error message again:
"Connected to database
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'description' cannot be null' in /home/ewff/public_html/prac0.php:66 Stack trace: #0 /home/ewff/public_html/prac0.php(66): PDOStatement->execute() #1 {main} thrown in /home/ewff/public_html/prac0.php on line 66". peace.