I'm trying to change my script from mysql connection to PDO and I managed to fetch data but there's an input box and based on the input fetched data is supposed to change but the results just disappear for me when i click 'search the table'
PHP Code:

"SELECT * FROM apps ";
try {

} catch ( 
PDOException $e ) {
"I'm sorry there is a problem with your operation..";
file_put_contents'dbErrors.txt'$e->getMessage(), FILE_APPEND );

if (isset(
$_POST['search'])) {

$search_term mysql_real_escape_string($_POST['search_box']);
$sql .= "WHERE app_name = '{$search_term}' ";
$sql .= " OR category = '{$search_term}'";
$stmt $con->prepare$sql );
    <form name="search_form" method="POST" action="apps.php">
    Search: <input type="text" name="search_box" value="" />
    <input type="submit" name="search" value="Search the table" >
                <table width="90%" cellpadding="5" cellspace="5">
<?php     while( $row $stmt->fetch()) { ?>
                        <td><?php echo $row['app_name']; ?></td>
                        <td><?php echo $row['category']; ?></td>
<?php ?>