Home >Backend Development >PHP Tutorial >Which PHP function is used to insert data into an existing MySQL table?

Which PHP function is used to insert data into an existing MySQL table?

WBOY
WBOYforward
2023-09-07 13:05:02666browse

Which PHP function is used to insert data into an existing MySQL table?

PHP uses the mysql_query function to insert data into an existing MySQL table. This function takes two parameters and returns TRUE on success and FALSE on failure. Its syntax is as follows -

Syntax

bool mysql_query( sql, connection );

The following are the parameters used in the function -

##1.##2 .Connection
S. No.

Parameters and description

SqlRequired - SQL query to insert data into an existing MySQL table

Optional - If not specified, the last opened connection by mysql_connect will be used. p>

The above is the detailed content of Which PHP function is used to insert data into an existing MySQL table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:PHP assertion errorNext article:PHP assertion error