It seems that the id for the last inserted record may not be set when you are on this page. As a test of this go into the code on your content details page and go to line 148. This should be the <h1> heading for that content.
On this line just before the </h1> add in this code:
<br/>The id for this record is: <?php echo $_SESSION['WADA_Insert_Contents'] ?>
This will let you know if the id has been set for the content. If you see an id value here it indicates the content was inserted without problem and the id was set for it. To check it look at your contents table in your db and look for the id listed. It should reflect the content you just added. Please check this out and run this test then let us know what the result is.