Home >Backend Development >PHP Tutorial >Summary of PHP PEAR DB class functions_PHP tutorial
PHP PEAR DB class function description:
connect(): database link function
query(): SQL statement Execution function
execute(): SQL statement execution function, which is slightly different from the query() function.
setFetchMode(): Set whether the returned record set is a numeric index array, an associative array or an object
numRows(): Return the number of rows in the record set
numCols(): Returns the number of columns in the record set
free(): Releases the record set
disconnect(): Closes the database link
affectedRows(): The number of record rows affected by the operation
isManip(): Determine whether a query is a data processing or data definition operation
Platform porting instructions:
Ideally, when porting to other types of database platforms, only modifications are needed The DSN string parameter in the PHP PEAR DB class function is sufficient, but for some queries unique to specific databases, they can only be modified when transplanted to other database platforms.
Others:
The DB directory stores all related databases supported by PHP PEAR DB class functions. Interested friends can take a look.
Through the above code examples, we can use the PHP PEAR DB class to implement the access functions of different databases.