To save data to the mysql database, we need to use update or insert to help us complete the process. below I will introduce several application examples to my friends who are learning php. I hope the article will help you. let's first introduce INSERT statement syntax 1: INSERT... to save data to the mysql database, we need to use update or insert to help us complete the process. below I will introduce several application examples to my friends who are learning php. I hope the article will help you.
Let's first introduce the INSERT statement.
Syntax 1: Insert into table_name VALUES ("1", "2 ")
Explanation2 values are inserted. The first value is 1 and the second value is 2.
Statement 2: Insert into table_name (column1, column2) VALUES (value1, value2)
Note: insert the specified value based on the specified key. The value of the column1 plug-in field is value1, and then the value of the column2 field is value2.
The code of the INSERT statement is as follows:
The code is as follows:
/** Data retention * Program: Liu Xing * Time: 2010-6 */
$ Value) {if (strstr ($ key, "fs") {if (strstr ($ key, "kfs") {$ khxm = substr ($ key, 3, strlen ($ key)-3); $ fs = $ zl [$ key]; continue;} // www.phprm.com else {$ khxm = substr ($ key, 2, strlen ($ key)-2);} $ khfs = $ value; $ khinfo = $ zl [$ khxm]; $ SQL = "delete from khzl where peopleid = '$ pid' and khbm = '$ khxm' and time = '$ jd' and year = '$ year '"; $ result = mysql_query ($ SQL); $ SQL = "INSERT INTO khzl (peopleid, khbm, fenshu, time, year , Info, fs) VALUES ('$ pid', '$ khxm', $ khfs, '$ jd', '$ year',' $ khinfo ',' $ Fs ') "; $ fs = 0; $ result = mysql_query ($ SQL) ;}}?>
"; Echo" location = 'Your lexz. php'; "; echo" script ";
Php entry network reminds you that when saving data, we should pay attention to the encoding between pages to avoid unnecessary troubles, in addition, the data type must be consistent with the data submitted. Otherwise, the data cannot be saved.
Article address:
Reprint at will ^ please include the address of this article!