I'm having trouble with getting my echo showing up. i think there is a problem with the while
but the table is in the mysql so it should work normally. This is my code
<?php
$sql = $db->prepare('SELECT
topic_id,
topic_subject
FROM
topics
WHERE
topics.topic_id = :topid');
$sql->bindParam(':topid', $_GET['id'], PDO::PARAM_INT);
$sql->execute();
$result = $sql->rowCount();
if($result === FALSE){
echo 'The topic could not be displayed, please try again later.';
}
elseif(count($result) === 0){
echo 'This topic doesn′t exist.';
}
else
{
while($row = $sql->fetch())
{
//display post data
echo '<table class="topic" border="1">
<tr>
<th colspan="2">' . $row['topic_subject'] . '</th>
</tr>'; ?>
the while
should show up because the topic exists in mysql. When i'm using avar_dump($sql->errorInfo());
it say's array(3) { [0]=> string(5) "00000" [1]=> NULL [2]=> NULL }
The null is because i created the topic in mysql as a test.