A Starter has prob in blog script
| From: | Silvio Siefke | Date: | Wed, 13 Apr 2011 21:06:27 +0000 |
| Subject: | A Starter has prob in blog script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-312392@lists.php.net to get a copy of this message | ||
Hello,
i has a CMS System, but want better write my website manually. Im
started at first with PHP or write a Program. I really not know what i
has to do, Google can not ask, i not know what should ask. Google with
"mysql link php foreach pdo" help not really.
I have for my blog two files, first is the the all entry list with a
link for the complete Entry. The file for list called bloggen.php, the
file for complete Entry called blogdetail.php. I has link the Entrys
from bloggen.php to blogdetail.php with blogdetail.php?blogid=1 or with
the other BlogID from Mysql.
The File bloggen.php run without any Problems. But the linking want not
work.
The code in blogdetail.php is:
-----------------------------------------------------------------------
<?php
require_once "inc/common.php";
if(isset($_POST['blogid']) && is_array($_POST['blogid']))
try {
$sql = 'SELECT blogid, content FROM
bloggen WHERE id = ' .$blogid;
$result = $DB->query($sql);
foreach ($_POST as $blogid => $result)
{
echo $result['content'];
}
$DB = null;
}
catch (PDOException $e)
{
echo "Fehler: " . $e->getMessage();
exit ();
}
?>
-----------------------------------------------------------------------
This code should use the link which come from bloggen.php in. Example,
when i click on link (blogdetail.php?blogid=1) that the script take the
content from database for this entry. I use PDO System, the content in
database is save as HTML code. I has no error in my PHP log, only the
database should communicate with php at the website call, but they not
take the right content.
-----------------------------------------------------------------------
110413 22:52:45 630 Connect root@localhost on silviosiefke
630 Query SELECT * FROM sessions WHERE id = 'aeon1g5odp5hi0ka31uqmk16l4'
630 Query SELECT * FROM bloggen WHERE id = blogid ORDER BY date DESC
630 Query DELETE FROM sessions WHERE lastUpdated < 1302727065
630 Quit
-----------------------------------------------------------------------
I really starter with Program Langs, i have much things really finished,
but now i really not know.
Can someone help me? Thank u so much.
Regards
Silvio