Hi
anyone have any idea why im getting a Parse error: syntax error, unexpected T_ELSE on line 28? i know it has to do with if($stmt->errorCode() == 0) { what im trying to do is add that so if there is no ticket number that you searched for in the database it will give you a message saying sorry ticket number cannot be found thanks.
anyone have any idea why im getting a Parse error: syntax error, unexpected T_ELSE on line 28? i know it has to do with if($stmt->errorCode() == 0) { what im trying to do is add that so if there is no ticket number that you searched for in the database it will give you a message saying sorry ticket number cannot be found thanks.
PHP:
<?php
require("db.php");
$error_message="";
if (isset($_POST['submit'])){
if(empty($_POST['term']))
{
$error_message="Please enter a Ticket Number.";
}
else
{
if($stmt->errorCode() == 0) {
$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)) {
echo htmlentities($department);
}
else
{
$error_message="sorry ticket number cannot be found.";
}
}
}
}
?>