Using MySQL: insert into

Creating a base is a simple but responsible task. Many factors must be considered. Noticeable progress in the hardware and software of information technology does not give reason to neglect the likelihood of a technical malfunction, unauthorized access, violation of the structure of tables, adding incorrect data.

MySQL insert into




A computer is not a person, and any, even the most “smart”, algorithm is still far from the ideas of natural intelligence: without the help of a programmer, it can do little. However, unlike a person, a program can consistently and correctly fulfill its mission, the main thing is to write it correctly.

MySQL concept: insert into

SQL . , . : , , .

MySQL insert into values




MySQL insert into, , -: « , ». , .





, . . -. : MySQL insert into select .

MySQL insert into select




. MySQL query insert into values , , , , .

MySQL - , . . select , into - . "*" , .

Adding multiple entries




$cSrcTable $cDstTable, .





MySQL insert into values , .

Adding one / several records




This query can be divided into three queries, in each of which one list of fields (`code_back`,` owner_code`, ...) will correspond to one row of data ('~', '{$ cSChip}', '{$ SChip_s } ', ...), (' ~ ',' {$ cPetr} ',' {$ cPetr_s} ', ...) or (' ~ ',' {$ cTest} ',' {$ cTest_s} ' , ...), but it’s easier. For example, in this case, a basic set of users has been added: administrator, dispatcher, and tester.

Adding entries through a custom interface

MySQL . . PHP, , - , . mysqli_query() .

- , / / . .

MySQL query insert into values




, . , scfAddUser('Ivanov', 'Ivan') MySQL insert into `all_users` ('last_name', 'first_name', 'status') values ('Ivanov', 'Ivan', 'new'). .

, , . .

, . , .

, : , , , ..

MySQL insert into : scfAddObject('contens', ...), -.

The date object will have the method myDate-> Save () and will call scfAddObject ('04 .12.2016 '), and the user object currUser-> Save () will make scfAddObject (' Ivanov - login '), ... with this every call to scfAddObject () will lead to the construction of its own version of the MySQL insert into query.




All Articles