TAILIEUCHUNG - Beginning PHP6, Apache, MySQL Web Development- P17
Beginning PHP6, Apache, MySQL Web Development- P17:Welcome to Beginning PHP6, Apache, MySQL Web Development , your new trusty resource for assistance in creating your own dynamic web sites. There are a lot of technologies available that can be used to deliver great web sites, and we ’ re glad you chose the Apache/MySQL/PHP (sometimes referred to simply as AMP) approach. You may or may not have had a taste of these three components in the past, but either way we ’ re confident that you will be impressed with the power that lies within them | Chapter 13 Building a Content Management System echo input type submit name action value Save Changes td tr table form If you ve looked around your web site you might have noticed that the article you just created doesn t show up yet. That s because you ve set up a review system wherein an administrator or moderator must approve an article before it is published for the public to view. This sort of control is found on many CMS-based sites on the web and it s a good way to keep an eye on quality and duplicate stories. Try It Out Reviewing New Articles In this exercise you ll create the reviewing system that lets you approve your articles. 1. Create php require include db mysql_connect MYSQL_HOST MYSQL_USER MYSQL_PASSWORD or die Unable to connect. Check your connection parameters. mysql_select_db MYSQL_DB db or die mysql_error db echo h2 Article Availability h2 echo h3 Pending Articles h3 sql SELECT article_id title UNIX_TIMESTAMP submit_date AS submit_date FROM cms_articles WHERE is_published FALSE ORDER BY title ASC result mysql_query sql db or die mysql_error db if mysql_num_rows result 0 echo p strong No pending articles available. strong p 451 Part II Comic Book Fan Site else echo ul while row mysql_fetch_array result echo li a href article_id . row article_id . . htmlspecialchars row title a . date F j Y row submit_date . li echo ul mysql_free_result result echo h3 Published Articles h3 sql SELECT article_id title UNIX_TIMESTAMP publish_date AS publish_date FROM cms_articles WHERE is_published TRUE ORDER BY title ASC result mysql_query sql db or die mysql_error db if mysql_num_rows result 0 echo p strong No published articles available. strong p else echo ul while row mysql_fetch_array result echo li a href article_id . row article_id . . htmlspecialchars row title a . date F j Y row publish_date . li echo ul mysql_free_result result include 2. Next .
đang nạp các trang xem trước