BLOG DESIGN (Post office web site) SOLUTIONS Creating a screen for listing
BLOG DESIGN SOLUTIONS Creating a screen for listing posts At this point, you can add and edit blog posts, but when it comes to editing a post you still have to know its post_id and type the number into your browser. Not exactly convenient, I m sure you ll agree. Far more useful would be a list showing all your blog posts so you can select which post to edit. And that s what I ll show you now. All that is required is one SELECT statement and a PHP loop. Here s the entire code; save it in your cms directory as index.php (because you ll want it to be the default page in your CMS):
All blog posts
“;} if($myposts) { echo “
- \n”; do { $post_id = $myposts[”post_id”]; $title = $myposts[”title”]; $dateattime = $myposts[”dateattime”]; echo “
- “; echo “$title . posted $dateattime”; echo “
\n”; } while ($myposts = mysql_fetch_array($result)); echo “
“;