[Introduction to PHP] 3, WAMP integrated MySQL-related basic operations

Source: Internet
Author: User
Tags getting started with php mysql in types of extensions phpmyadmin

In this paper, we understand the MySQL in Wamp integrated development environment with small white angle, which involves wide and shallow, which is the nature of guidance.

1. Start running MySQL in the familiar Wamp

There is a library, then a table, and the data is eventually inserted into the table as a record. Where the data is manipulated using SQL statements, SQL is a structured query language.

The MySQL database is already built into the WAMP, and you can start the MySQL service by doing the following (you must start the MySQL server each time you use the database)

2. Introduction to the console operation database

We can connect and manipulate the database via the console: (where the default is no password, the direct return is possible)

The commands that are commonly used in the console are show, create, drop, and so on:

mysql> show databases;

3. Introduction of phpMyAdmin Visual Operation database

The console is not easy to operate, so you can use phpMyAdmin to visualize MySQL database operation graphical interface (WAMP).

4. Basic knowledge of table-building and table operation

4.1, build the table:

When you create a table, you set the name, engine, encoding, and field information in the table.

You need to specify the engine when you build the table, different engines provide different functions;

    fields are used to indicate what types of data are used in this table: int, varchar, data (date), text (up to 65535)

4.2. Table Operation:

Insert into Table name (field list) value (Value list)

SELECT * FROM table name

SELECT * FROM table name where

Delete from table name where condition

Update table name set field 1= value 1, field 2= value 2 .... Where condition

5. PHP Operation MySQL

5.1. Open MySQL Extension:

There are 3 types of extensions: ①mysql extension (old, basic not); ②mysqli extension; ③pdo extension;

5.2. To use MySQL extension as an example, use PHP to operate MySQL

is actually a function call, when the extension is opened, you can call the extension provided by the corresponding function to connect to the database, read and write delete operations. By default, the user name is root and the password is empty

The following several MySQL extensions open several important interfaces:

mysql_connect (MySQL server IP, username, password)

mysql_select_db

Mysql_query

Mysql_fech_array

1<?PHP2 $conn=mysql_connect("localhost", "root", "" ");3 mysql_select_db("MySQL",$conn);4 $results=mysql_query("Set names Utf-8");//Set Encoding5 $results=mysql_query("SELECT * from User");6 $row=Mysql_fetch_array($results);//Each call displays one, so a loop call is required7 Var_dump($row);8?>

Ago:

[Introduction to PHP] 1, from the installation and development environment to (Zhuang B) to do a cool landing application

[Introduction to PHP] 2, basic core Grammar outline

[Getting Started with PHP] 3, WAMP integrated MySQL-related basic operations

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.