Home > Backend Development > PHP Tutorial > PHP became a monk halfway (3)_PHP tutorial

PHP became a monk halfway (3)_PHP tutorial

WBOY
Release: 2016-07-13 17:50:40
Original
954 people have browsed it

Foreword
I reflected on some things I wrote recently and had some small feelings

For coders who have learned Java or C++,

It’s meaningless to talk about grammar, OOP, exceptions and other technologies

It’s not something you can learn by looking at simple example codes,

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

START!
I won’t blog about my knowledge for the time being, so let’s blog about it for the time being~

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

Need a good storage model





Three tables that need to be created in the database

Use related IDs to match each data

General logical framework of blog


config.php
Function: Provide constants, usually some simple configurations.

Content:

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

Blog related---[Blog name] [Author] [Root directory of homepage]

header.php
Function: Initialization work for each blog page

Content:

The title at the top of the blog for each page --- html

Database connection---MySQL

Login verification---After logging in correctly, you can manage your blog---SESSION

footer.php
Function: Add author logo at the bottom of each page.

Content: © Matter

index.php
Function: display articles, view comments, display previous articles

Content:

Query articles in the database---MySQL

Display article title and content---PHP

viewentry.php
Function: Use anchor points to view comments and add comments

Content:

Verify first and get the ID number---GET

Connect to the database and find articles corresponding to ID---MySQL

Find all comments---MySQL

Display articles and comments---php

Form for submitting comments---html

viewcat.php
Function: Category browsing

Content:

Determine the request id---php

Display all articles under the corresponding ID---MySQL

Login.php
Function: Login---session

Logout.php
Function: Logout---session

addentry.php
Function: Add article www.2cto.com

Content:

Verify user---session

Write categories and articles---html

Add content to database

updateentry.php
Function: Modify article

Content:

Verification

UPDATE command of database

A little gain from coding
1.date() time format

date()符号 日期
D Sat
D j Sat 12
D jS Sat 12th
D jSF Sat 12thMay
D jS FY 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 the page, you can use header and footer files to produce fixed effects

3. Simple format of SQL statement: SELECT (selection)--WHERE (condition)--ORDER BY (sort)--DESC (reverse order)--LIMIT (limit)


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


5. Overview of the use of $_GET and $_POST super global variables


6. Go through the programming practice of database and web pages by hand


Small thoughts
This is my first PHP+MySQL small program. The motivation for doing this is that when I was learning PHP, I thought the syntax was in place and wanted to try it. But I encountered a lot of difficulties.

Good things

Understood the process and principles of deploying a BLOG on a server.


Have a certain understanding of the role of PHP in programming

Use MySQL to interact with the page

I learned about anchor points, sessions and other things I had only heard of before

The Bad

Following the book coding, the overall sense is not enough (summarize it in the blog to make it clearer).


My HTML layout and CSS styles are not well mastered. These two aspects cause my pages to always be inexplicably messed up.

Also, I don’t have a good grasp of the SQL language. I can only operate in a very "simple" way, and the feeling of not mastering it is obvious


In short, I have a clearer sense of direction in learning PHP. I hope I can continue to work hard in the future!!!


Excerpted from matter605924657


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478242.htmlTechArticleThe preface reflects on some things I have written recently, and some small feelings are old for coders who have studied Java or C++. Talking about syntax is meaningless. OOP, exception and other technologies are not about looking at simple example codes...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template