Skip to main content

PHP MySQL Database Essential Knowledge Points Notes

· 2 min read
zenge
Software Rookie @ China

phpmysql

1、MySQL Integer Data Types and Data Length

Review occasionally. mysql int data type

Importing large amount of data using LOAD DATA INFILE command will significantly increase the speed.

The LOAD DATA INFILE statement returns information string in the following format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0

2、PHP

set_time_limit(0); Used to set the execution time of the current PHP script to unlimited

mysql_query() Returns a resource identifier only for SELECT SHOW EXPLAIN , or DESCRIBE statements, or FALSE if the query execution is incorrect.

For other types of SQL statements, mysql_query() returns different values upon successful execution, which can be obtained using mysql_info().

When an error occurs, FALSE is returned.

A non-FALSE return value means that the query is valid and can be executed by the server

It is very likely that a query has been executed successfully but has not affected or returned any rows.

Therefore, be careful with the SQL statements passed in PHP and their return values.**

'\\n'No line break

"\\n" Line break occurs because it is enclosed in double quotes

varchar(n) If the number of input characters exceeds n, only the first n characters are taken

It is best to set a password for the test database in the development environment

In development environment we Want to directly connect to the local or a public MySQL database, Please use the following statement to create a new authorized user.

grant all PRIVILEGES on *.* to 'user'@'%' identified by '123456';
flush privileges;

After execution, please check if the user has been successfully added in table mysql of the database mysql.

You also need to check if there are any records in the table that block specific IPs or localhost, 127.0.0.1.