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