can anyone help me and tell me what's wrong with this script.i haven't had to write script for a while. since before PDO. i've been working at and just can't seem to get it. any help would be much appreciated.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
/*** mysql hostname ***/
$hostname = 'xxxx';
/*** mysql username ***/
$username = 'xxxx';
/*** mysql password ***/
$password = 'xxxxa';
try {
$dbh = new PDO("mysql:host=$hostname;dbname=new_order", $username, $password);
$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 = array();
if(empty($errors))
// prepare sql and bind parameters
$stmt = $dbh->prepare("INSERT INTO new_order (item, temple, quantity, price) VALUES(?,?,?,?)");
$stmt->bind_param("ssss", $item, $temple, $quantity, $price);
$stmt->execute();
/*** close the database connection ***/
$dbh = null;
?>
</body>
</html>
the attached image shows the error message when processing this script. any guidance will be accepted and implemented. thanks, all.