1INSERT INTO table1 (col1, col2) VALUES (3, 'A string');
2INSERT INTO table1 (col1) VALUES (3); -- col2 will be NULL if allowed
3INSERT INTO table1 VALUES (3, 'A string'); -- all table1 columns
4INSERT INTO table1 (col1, col2) SELECT value3, value1 FROM table2;
1INSERT INTO table_name (a, b) VALUES (val1, val2);
2INSERT INTO table_name (a, b) VALUES (val1, val2), (val3, val4); -- 2 rows
3
4-- From a query:
5INSERT INTO table_name (a, b)
6 SELECT val1 AS a, val2 AS b
7 FROM source_table s
8 WHERE s.val1 >= 10;
1INSERT INTO client (prenom, nom, ville, age)
2 VALUES
3 ('Rébecca', 'Armand', 'Saint-Didier-des-Bois', 24),
4 ('Aimée', 'Hebert', 'Marigny-le-Châtel', 36),
5 ('Marielle', 'Ribeiro', 'Maillères', 27),
6 ('Hilaire', 'Savary', 'Conie-Molitard', 58);
1INSERT INTO "table_name" ("column1", "column2", "column3", ...)
2VALUES ('value1', "value2", 'value3', ...);
1<!DOCTYPE html>
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5<title>Contact Form - PHP/MySQL Demo Code</title>
6</head>
7
8<body>
9<fieldset>
10<legend>Contact Form</legend>
11<form name="frmContact" method="post" action="contact.php">
12<p>
13<label for="Name">Name </label>
14<input type="text" name="txtName" id="txtName">
15</p>
16<p>
17<label for="email">Email</label>
18<input type="text" name="txtEmail" id="txtEmail">
19</p>
20<p>
21<label for="phone">Phone</label>
22<input type="text" name="txtPhone" id="txtPhone">
23</p>
24<p>
25<label for="message">Message</label>
26<textarea name="txtMessage" id="txtMessage"></textarea>
27</p>
28<p> </p>
29<p>
30<input type="submit" name="Submit" id="Submit" value="Submit">
31</p>
32</form>
33</fieldset>
34</body>
35</html>
36