MySQLI VS mysql (Comparison And Deferent) / Functions

Mysqli is an PHP  interface  to  intract with Mysql.Myslqlli  is class so we get the fullfeturs of OOP(object-oriented programming)

MYSLQL MYSLQLI
Fully Object Oriented Not Support Object Oriented Connection
Some times 40 times faster Slower
Have Prepare Statement Not Have Prepare Statement
More Secure (Eg, Prevent SQL Injection) Compare to mysql Not Secure

mysqli Class functions

  • mysqli – construct a new mysqli object
  • autocommit - turns on or off auto -commiting database modifications
  • change_user - changes the user of the specified database connection
  • character_set_name - returns the default character set for the database connection
  • close - closes a previously opened connection
  • commit - commits the current transaction
  • connect - opens a new connection to MySQL database server
  • debug - performs debugging operations
  • dump_debug_info - dumps debug information
  • get_client_info - returns client version
  • get_host_info - returns type of connection used
  • get_server_info - returns version of the MySQL server
  • get_server_version - returns version of the MySQL server
  • init - initializes mysqli object
  • info - retrieves information about the most recently executed query
  • kill - asks the server to kill a mysql thread
  • multi_query - performs multiple queries
  • more_results - check if more results exist from currently executed multi -query
  • next_result - reads next result from currently executed multi -query
  • options - set options
  • ping - pings a server connection or reconnects if there is no connection
  • prepare - prepares a SQL query
  • query - performs a query
  • real_connect - attempts to open a connection to MySQL database server
  • escape_string - escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection
  • rollback - rolls back the current transaction
  • select_db - selects the default database
  • set_charset - sets the default client character set
  • ssl_set - sets ssl parameters
  • stat - gets the current system status
  • stmt_init – initializes a statement for use with mysqli_stmt_prepare
  • store_result - transfers a resultset from last query
  • thread_safe - returns whether thread safety is given or not
  • use_result - transfers an unbuffered resultset from last query

mysqli Class properties:

  • affected_rows - gets the number of affected rows in a previous MySQL operation
  • client_info - returns the MySQL client version as a string
  • client_version - returns the MySQL client version as an integer
  • errno - returns the error code for the most recent function call
  • error - returns the error string for the most recent function call
  • field_count - returns the number of columns for the most recent query
  • host_info - returns a string representing the type of connection used
  • info - retrieves information about the most recently executed query
  • insert_id - returns the auto generated id used in the last query
  • protocol_version - returns the version of the MySQL protocol used
  • server_info - returns a string that represents the server version number
  • server_version - returns the version number of the server as an integer
  • sqlstate - returns a string containing the SQLSTATE error code for the last error
  • thread_id - returns the thread ID for the current connection
  • warning_count - returns the number of warnings generated during execution of the previous SQL statement