How to use phpmyadmin to create a MYSQL database-PHP Tutorial

Source: Internet
Author: User
Tags how to use phpmyadmin
Describes how to use phpmyadmin to create a MYSQL database. First, create a database named webjxcom. Create a data table named Article in this database. Next we will enter a key point, that is, to create each field under the table Article. First, create a database named webjxcom. Create a data table named Article in this database. Next we will enter a key point, that is, to create each field under the table Article.

So what is a field? It is a general term for a type of things. For example, all the news are represented by one term. We use "time" for representation. We set the title field to "title ". In fact, we can make each title or time content correspond to a number, that is, the field --

"Id": the field "id" is a default preferred field. content in other fields can be repeated, but this field is an Arabic number that increases from 1. When setting this field, you must set the primary key, index, unique, and auto-increment. This auto-increment is automatically added. When content is added to any field, this field is automatically increased by 1, that is, any field corresponds to a unique id, such as 1, 2, 7 ......

Next we will talk about the establishment of some fields in news.

1. id: indicates the number of each news item. it is unique and the type is tingint. the length of the tingint type is not required. The system defaults to 4. in the "extra" field, select auto-increment, and select the primary key.

2. author: it indicates the author (News publisher). set the type to varchar. when setting the length of this field, if the authors are all Chinese, the maximum length of 8 bytes is (4 Chinese characters ), however, given that the author may be a foreigner and the number of 8 bytes is obviously too small, the same problem exists for other fields. here we will set the length to 8.

3. title: indicates the news title. the type is varchar and the length is 60.
4. content: indicates the news content. the type is text. You do not need to set the length for this type.

5. from: indicates the news source. the type is varchar and the length is 60.

6. addtime: indicates the publication time. The data type is datetime. you do not need to set the length. 7. hits: indicates that the CTR type is varchar and the length is 60.
The following describes the field types:

1. date: time and date type. The time and date types also include:

Required datetime: 0000-00-00 00:00:00

Expiry date: 0000-00-00

⊕ Timestamp: 00000000000000 (14 0, length depends on the display size)

Elapsed time: 00:00:00

Seasonal year: 0000

2. the content field indicates the news content. because the size may be large, the text type is used (up to 65535 bytes are supported)

3. the title field is set to primary key. if there is no news item with the same posting time, the date field can also be used as the primary key, which makes it easier to sort and retrieve news in the future.

4. although a text field belongs to a character type, its size cannot be specified. if the length is set, an error occurs in the SQL statement.

Now, the article table is created.

Since not everyone can add news, only administrators can do it, so now let's create a data table member to store administrators.

1: id: tinyint type, auto-increment and primary key.

2: username: indicates the user name. The type is varchar. the length is 8 and the attribute is primarykey.

3: userpass: password, varchar, and 32 characters in length.

4: email: it indicates the email address. the type is varchar and the length is 30.

Webjxcom. Create a data table named Article in this database. Next we will enter a key point, that is, to create each field under the table 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.