Step by step teach you to use Php+mysql Build website No.6 article publish

Source: Internet
Author: User

In this section we take a look at 3 pages related to publish: publish.php, unpublish_story.php and publish_story.php

We go back to Admin's homepage, index.php


We click on the link below to jump to the

publish.php



Overall over the code, there should not be much new content, we focus on the structure:

4-6 rows

As with Editer, the login interface is displayed if the current user is not already logged in

9-13 rows

Displays the name of the current login author, as well as 3 links, logout, main menu, and return home page

15-18 rows

This SELECT statement is to find out the current author's story

25-40 rows

Similar to the story.php page, here we also list the author's published and unpublished articles.

And if the current published column is not NULL, the Unpublish link is displayed, otherwise the publish and delete links are displayed, like this:


Next, let's see.

publish_story.php


In fact, this page is very simple, is to update the next record, the original published column set to the current time.

Notice that no commit was performed here, and then I checked:

MySQL does not need to display commit commit because the autocommit inside MySQL is on, that is, it is automatically submitted .

For more information, please click here:

About MySQL commit and rollback


And then the same,

The unpublish_story is also very simple:


Just set the published field in the current record to null.


Here, about the publish of the relevant pages we have done, the last one, keywords and search, we will explain in the next blog.



Step by step teach you to use Php+mysql Build website No.6 article publish

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.