PHP MySQL functionsThere are many PHP functions which works in MySQL to execute queries. PHP & MySQL has became most popular web scripting language in internet today because of these functions and flexibility of PHP program. There are many popular scripts for forums, content management, classified programs, e-commerce sites etc runs in PHP scripts by using MySQL database. To manage these scripts we use these PHP functions.
It is recommended by PHP.NET to use PDO_MySQL or MySQLI extensions. The old MySQL extension was deprecated in PHP 5.5.0 and was removed in PHP 7
We will discuss these functions in detail with examples to make it simple to understand.
MYSQLI PDO default_password_lifetimeSet the value in days for user or for global to expire the password.mysql_affected_rowsHow many rows or records get updated or deleted or affected by a given query.mysql_auto_incrementAdding one incremented auto number to each record once added.mysql_closeClosing one open connection to MySQL database.mysql_connectConnecting string to store userid and password and database name to connect to MySQLmysql_create_dbCreate a database in MySQLmysql_db_nameList the name of all databases in MySQLmysql_errnoAssociated error number of each mysql querymysql_errorError message after executing a querymysql_fetch_fieldwe can get the type of field with all other details about the fieldmysql_fetch_lengthsget the length of data used in all fields of a recordmysql_fetch_rowget the row of data from a MySQL tablemysql_field_flagsgetting the field flags associated with the field.mysql_field_typeType of field used in MySQL table.mysql_insert_idGet the auto increment id of the last inserted recordmysql_list_dbsList of database in MySQLmysql_list_tablesList of tables present in a databasemysql_num_fieldsNumber of fields present in a query or in a tablemysql_num_rowsGetting the total number of rows in a query or in a tablemysql_queryFunction to execute any query statement in MySQL database mysql_field_lenmysql_field_name MySQL Version
This article is written by plus2net.com team.
![]() ▼ More on getting records from table with different combinations of commands |