Hi

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:
<?php


$sql 
"SELECT * FROM apps ";
try {
    
$con = new PDODB_DSNDB_USERNAMEDB_PASSWORD ); 
     
$con->setAttributePDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION );


} catch ( 
PDOException $e ) {
    echo 
"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 );
    
$stmt->setFetchMode(PDO::FETCH_ASSOC);
    
$stmt->execute();
?>
    <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" >
    </form>
                <table width="90%" cellpadding="5" cellspace="5">
                    <tr>
                        <td>Name</td>
                        <td>Category</td>
                        <td>Details</td>
                    </tr>
<?php     while( $row $stmt->fetch()) { ?>
                    <tr>
                        <td><?php echo $row['app_name']; ?></td>
                        <td><?php echo $row['category']; ?></td>
                        <td>Details</td>
                    </tr>
<?php ?>
                </table>