This is now working. I'm not passing the username with the query as I have that as a session variable in postnote.php