PHP Half Way Home (3)

Source: Internet
Author: User
Tags mysql book php and mysql book
PHP Half Way Home (3) Preface

Reflecting on some of the recently written things, I feel a little bit

For coder that has learned java or C ++,

The syntax is meaningless, such as OOP and exceptions.

Instead of simply looking at the instance code,

If you don't understand it, you can google it ~


I am not writing dead knowledge on the blog for the time being. I suggest you write a blog on the blog for the time being ~

The plan is the first instance in the Practical PHP and MySQL book.

Requires a good storage model

Three tables to be created in the database

Match data with related IDs

General logic framework of blog

Config. php

Function: provides constants, which are generally simple configurations.


Database --- [host] [username] [password] [dbname]

Blog-[blog name] [author] [root directory of the homepage]

Header. php

Function: initialize each blog page.


Top blog title of each page --- html

Database Connection --- MySQL

Login verification-after correct login, you can perform blog management-SESSION

Footer. php

Function: add the author flag at the bottom of each page.


Index. php

Function: Display articles, view comments, and display previous articles


Query articles in the database --- MySQL

Show article title and content --- PHP

Viewentry. php

Function: use the anchor to view comments and add comments.


Verify first and GET the ID number --- GET

Connect to the database and find the article with the corresponding ID --- MySQL

Find all comments --- MySQL

Show articles, comments --- php

Form for submitting comments --- html

Viewcat. php

Function: classified browsing


Determine the request id --- php

Show all articles under the corresponding ID --- MySQL

Login. php

Function: login --- session

Logout. php

Function: logout --- session

Addentry. php

Function: add an article


Verify user --- session

Write category and article --- html

Add content to database

Updateentry. php

Function: modify an article



Database UPDATE command

Small gains in coding

1. date () time format

Date () Date
D Sat
D j Sat 12
D jS Sat 12th
D jS F Sat 12th May
D jS F Y Sat 12th May 2012
D jS f y g Sat 12th May 2012 3
D jS f y g. Sat 12th May 2012 3.
D jS f y g. I Sat 12th May 2012 3.06
D jS f y g. iA Sat 12th May 2012 3.06PM

2. when designing a page, you can use the header and footer files to produce a fixed effect.

3. simple SQL statement format: SELECT (SELECT) -- WHERE (condition) -- ORDER BY (SORT) -- DESC (reverse) -- LIMIT (LIMIT)

4. use the config. php file to save some configuration information constants.

5. usage overview of $ _ GET and $ _ POST Super global variables

6. programming practices for databases and web pages

Small feelings

This is my first PHP + MySQL Applet. the motivation for doing this is to learn PHP and think that the syntax is in place. I want to try it, but I have encountered a lot of difficulties.

Good aspect

I learned how to deploy a BLOG on a server and how it works.

Have some understanding of PHP's role in programming

Use MySQL to interact with pages

I have learned about the anchor, session, and other content that I have previously heard.

Bad aspect

I don't have enough overall experience in coding with books (it's clear to summarize it in my blog ).

The HTML layout and CSS style are not well mastered. These two aspects lead to the inexplicable disorder of my pages.

In addition, the SQL language is not very good at understanding, but it will only be very "simple" operations, and it is obvious that you have not mastered it.

In short, I have a clear sense of direction for myself to learn PHP. I hope I can continue to work harder in the future !!!

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: 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.