Hi
i was wondering if anyone had any idea what im doing wrong for the error handling in my script? what im trying to do is if there is no record in the database it will show a message saying no record found when a search is made.
[code=php]<?php
require(“common.php”);
$error_message=””;
if (isset($_POST[‘submit’])){
if(empty($_POST[‘term’]))
{
$error_message=”Please enter a Ticket Number.”;
}
else
{
$query = “SELECT department, subject, message FROM supporttickets Where ticketnumber LIKE :term”;
$stmt = $db->prepare($query);
$stmt->execute(array(‘:term’ => $_POST[‘term’]));
while (list($department,$subject,$message) = $stmt->fetch(PDO::FETCH_NUM)) {
///I’M SURE THIS IS WRONG
if($stmt->rowCount()>1)
echo ‘no record found’;
else
echo htmlentities($department);
}
}
}
?>