Three. Create and populate the database
1. A Web application is a dynamic Web site designed to meet a user's specific goals
2. In PHP code, the SQL statement does not need to end with a semicolon, and each SQL statement at the end of the MySQL terminal has a semicolon
3. Creating databases: CREATE DATABASE database_name
Creating tables: CREATE TABLE table_name (column_name1 column_type1,column_name2 column_type2,......)
Select default database: Use database_name
Structure of the display table: DESCRIBE table_name
Delete tables: DROP TABLE table_name
Delete data: Delete from table_name
Specify a range with a WHERE clause
4. There may be objections to how the yes/no value is represented in MySQL, char (1) This method is straightforward and efficient.
5. Prompt, which indicates that you are still entering the same statement, the statement ends with a semicolon and MySQL executes the statement
6. The Mysqli_fetch_array () function stores a row of data in an array
7. Code examples
$from = ' jarray@foxmail.com '; $subject = $_post[' subject '); $text = $_post[' Elvismail '); $DBC = Mysqli_connect (' localhost ', ' root ', ' ', ' elvis_store ') or Die (' Error connecting to MySQL server. '); $query = "SELECT * from Email_list"; $result = Mysqli_query ($dbc, $query) //Execute SQL Statement or Die (' Error querying database. '); while ($row = Mysqli_fetch_array ($result)) the {//While loop condition is the return value of the Mysqli_fetch_array () function $to = $row [' email ']; $first _name = $row [' first_name ']; $last _name = $row [' last_name ']; $msg = "Dear $first _name $last _name,\n$text"; Mail ($to, $subject, $msg, ' from: '. $from); Echo ' Email sent to: '. $to. '
'; } mysqli_close ($DBC);? >
The above describes the head first PHP&MYSQL study Note (ii), including the content, I hope to be interested in PHP tutorial friends helpful.