Advanced Materials
Insert and Update
Suppose you want to insert the following data into the database.
ID = 3
TheDate = mktime (2001,)/* 31st August */
Note = sugar why don't we call it off
When you use another database, your insert operation may not be successful.
The first problem is that each database has a different default date format. The default MySQL format is YYYY-MM-DD, but other databases have different default formats. ADODB has a DBDate () function that converts a date to a correct format.
The next question is that the don't In the Note field value should be used as a citation. In MySQL, don't is used to solve this problem, but don't is used in some other databases (Sybase, Access, MicrosoftSQL Server. Qstr () solves this problem.
How can we use this function? As shown below:
$ SQL = "INSERT INTO table (id, thedate, note) values (". $ ID. ','. $ db-> DBDate ($ TheDate ). ','. $ db-> qstr ($ Note ). ")"; $ db-> Execute ($ SQL); ADODB also supports $ connection-> Affected_Rows () (returns the number of rows affected by the last update or delete operation) and $ recordset-> Insert_ID () (returns the last auto-increment number generated by the insert Statement ). But it should be noted that all databases support these two functions.
Policypes
You can find