I've been learning php/mySQL thru a manual by sitepoint and have run into a problem trying to complete a challenge in the book.
They've asked me to create a delete confirmation screen for a db of jokes. I'd like to list the the name of the author to be deleted and all of his/her jokes. I believe the bindValue command is causing me issues...
Any insight as to what my be wrong in this code would be great help. Cheers!
- Code: Select all
<?php
include $_SERVER['DOCUMENT_ROOT'] . '/phpbed/includes/dbconnect.php';
echo 'test3<br>';
echo 'id ' . $_POST['id'] . '<br>';
echo $_POST['id'];
$sql = 'SELECT joketext FROM joke WHERE authorid = :id';
$sql->bindValue(':id', $_POST['id']);
$result = $pdo->query($sql);
echo "test4";
while ($row = $result->fetch())
{
$joke[] = $row['joketext'];
}
echo 'test5';
?>
<div>
including all of this authors jokes?
</div>
<?php foreach ($joke as $bleh): ?>
<blockquote>
<p><?php echo $bleh; ?> </p>
</blockquote>
<?php endforeach; ?>
Please note that i've plopped a bunch of test echoes and i can't seem to get past test4.
Thanks guys!


