Hi all, after way too much time, research, criticism and even some suggestions this is my code to create a dropdown

from a table, select row, display the row and update one field "lastused" using NOW().



error is"No rows returned matching id"
PHP Code:
<?php
$db 
= new mysqli('localhost''root''cookie''homedb');
if (
$db->connect_error) die ('Database connection failed: ' $db->connect_error );

$emailStmt $db->prepare('SELECT * FROM emailtbl WHERE id = ? ');
$emailStmt->bind_Param('s'$id); // *****************
$emailStmt->execute();
                                  
    if (
$email $emailStmt->fetch())
    { echo 
'Last date accessed was '$email['lastused'];
    
$lastStmt $db->prepare('UPDATE emailtbl SET lastused = NOW() WHERE id = ? ');
    
$lastStmt->bind_Param('s'$id); // **********************
    
$lastStmt->execute(); }      
  
    else die( 
'No rows returned matching id ' $id ); // *******************
 
?>
HTML Code:
<!DOCTYPE html><html><head><title>email menu</title>
<LINK REL=StyleSheet HREF="lastused.css" TYPE="text/css">
</head><body>
<!-- ------------------------------------------------------------------------ -->
PHP Code:
<?php 
    $db 
= new mysqli('localhost''root''cookie''homedb');
    if (
$db->connect_error) die ('Database connection failed: ' $db->connect_error);
    if (isset(
$_POST['target']))
 { 
    
$emailStmt $db->prepare('SELECT target, username, password, emailused, lastused, purpose, saved
        FROM emailtbl WHERE target = ? '
);
    
$emailStmt->bind_Param('s'$_POST['target']); // *******************
    
$emailStmt->execute();
                          
    if (
$email $emailStmt->fetch())
 {
        echo 
'
            <table class="emailMenu">
               <caption>Email menu</caption>
                <thead>
                    <tr>
                        <th scope="col">username</th>
                        <th scope="col">password</th>
                        <th scope="col">emailused</th>
                        <th scope="col">lastused</th>
                        <th scope="col">purpose</th>
                        <th scope="col">saved</th>
                    </tr>
                </thead><tbody>'
;

                do
// ------------------------------------------------------
                 
{ echo '
                    <tr>
                        <td>'
$email['target'], '</td>
                       <td>'
$email['username'], '</td>
                        <td>'
$email['password'], '</td>
                        <td>'
$email['emailused'], '</td>
                        <td>'
$email['lastused'], '</td>
                        <td>'
$email['purpose'], '</td>
                        <td>'
$email['saved'], '</td>
                    </tr>'
; } 
// --------------------------------------------------------
        
while ($email $emailStmt->fetch());
        echo 
'
                </tbody>
            </table>'
;

  } 
           else echo 
'No Matches found!<br />';
 
  } 
          else echo 
'You failed to fill out a required field<br />'
  
?>
HTML Code:
</body></html>