Hongmu Notes
Home PHP PHP and mysql

PHP and mysql

PHP + MySQL database operations represent the most common combination for PHP database interactions; typically, working with MySQL databases using PHP involves tasks such as establishing database connections, reading data, executing queries, and performing backups. This is an essential foundational skill for developing large-scale PHP projects.

php import sql file into database

php import sql file into database Language Notes PHP PHP collection PHP and mysql

Using PHP to import an SQL file into a database is commonly employed during source code installation; this code encapsulates a class sourced from the internet: <?php /** * Created by PhpStorm. * User: Administrator * Date: 2018/10/13 * Time: 10:25 */ class ImportData{/...
👁 217
php sql read and write operation database

php sql read and write operation database Language Notes PHP PHP collection PHP and mysql

I am about to learn object-oriented, so some codes need to be deleted. Here is a record. This string of code is mainly used for writing operations in the empire database, etc.
👁 123
How does PHP operate sqlite database?

How does PHP operate sqlite database? Language Notes PHP PHP collection PHP and mysql

The PHP code below demonstrates how to connect to an existing database. If the database does not yet exist, it will be created; finally, a database object will be returned. <?php class MyDB extends SQLite3 {function __construct() {$this->open('test.db'...
👁 176
mysqli in PHP

mysqli in PHP Language Notes PHP PHP collection PHP and mysql

The `mysqli_num_rows()` function is exclusively used with `SELECT` query methods, whereas the `mysqli_affected_rows()` function returns the number of rows affected by the previous SQL statement across the entire database; this function is primarily used with `INSERT`, `UPDATE`, and `DELETE` operations.
👁 145
PHP mysqli

PHP mysqli Language Notes PHP PHP collection PHP and mysql

Execute a database query: Delete database; <br/>?php // Assume database username: root, password: 123456, database name: RUNOOB; $con = mysqli_connect('localhost', 'root', '123456', 'RUNOOB...');
👁 232
php mysqli database connection

php mysqli database connection Language Notes PHP PHP collection PHP and mysql

MySQLi database connection: `<?php define('DB_NAME', 'api_4s5_cn'); define('DB_USER', 'api_4s5_cn'); define('DB_PASSWORD', '4Eh6DEsLCT5HebjR'); define('DB_HOST', 'lo...');`
👁 182
PHP special character escaping and restoration

PHP special character escaping and restoration Language Notes PHP PHP collection PHP and mysql

Escape character is a special character constant. Escape characters are backslashed " & quot; At the beginning, followed by one or more characters. The escaped character has a specific meaning, which is different from the original meaning of the character, so it is called "escaped" character. The use of escape characters 1: turn ordinary characters into special purposes, such as back key and enter key. 2. Used to convert a character with special meaning back to its original meaning. 3. Before data is written into the database, escape characters (function …
👁 180
PHP cast type

PHP cast type Language Notes PHP PHP collection PHP and mysql

Get the data type 1. If you want to check the value and type of an expression, use var_dump(). 2. If you just want to get an easy-to-read type expression for debugging, use gettype(). 3. To check a certain type, do not use gettype(), but use the is_type() function. Converting Strings to Numbers When a string is evaluated as a number, the result is determined according to the following rules...
👁 232
1 2 3