Ι Decided to create my own clone of Digg and I wrote this little piece of code, which just display title and description.
<?php
try
{
$pdo = new PDO('mysql:host=localhost;dbname=informal','vad','6989');
$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$pdo->exec('SET NAMES "utf8"');
} catch(PDOException $e) {
echo $e->getMessage();
}
$sql = 'SELECT title,content FROM postID';
$result = $pdo->query($sql);
while($row = $result->fetch())
{
echo $row['title'] . "<br />";
echo $row['content'] . "<br />";
}
?>
And I would like, that title to be a link, and when user click on that link, database could define this record and show this article in the new page. True the fact, I did it with input type = hidden
, that when you click to button "open" and it shows all. I need a more flexible approach, just like in Digg.