MySQLi (MySQL Improved) provides procedural and object oriented interface to data and its management. The i extension MySQL functions allows the user to access its database servers. The MySQL improved extension is specially designed to work with MySQL version 4.1.13 and new versions. Show
We cannot cover everything under this topic, but let us look into some of the
important procedural functions php
Output: Connection established successfully. 2. mysqli_connect_error():
Connection failed as the target machine actively refused it. Note: php
3.
mysqli_select_db(): php
Result: php
Note: php
Output: Connection closed successfully. 6. mysqli_prepare(): php
Output: New record inserted successfully 7. mysqli_query(): php
Output: Inserted successfully 8. mysqli_rollback(): php
9. mysqli_fetch_row(): php
Result: php
Output: 4 11. mysqli_fetch_array(): php
Output: table array 12. mysqli_fetch_all(): php
Note: The above function is only available with MySQL Native Driver. php
Output: Item name :box, Description : square shaped box in red colour 14. mysqli_num_rows(): php
Output: Total number of rows of the result : 8 15. mysqli_affected_rows(): php
Output: Total affected rows : 8 16. mysqli_get_server_info(): php
Output: The MySQL server version is : 5.6.21 17. mysqli_fetch_fields(): php
Output: Column name : item_name Table name : items_info Maximum length : 18 Column name : description Table name : items_info Maximum length : 35 18. mysqli_error(): php
19.
mysqli_autocommit(): php
20. mysqli_error_list(): php
21. mysqli_begin_transaction(): php
22. mysqli_change_user(): php
Output: Default database : OTHER_GFG 23. mysqli_character_set_name(): php
Output: Default character set is: latin1 24. mysqli_real_escape_string(): php
Output: One record added successfully Why we use MySQLi instead of MySQL?Reasons why you should use MySQLi extension instead of the MySQL extension are many: MySQLi gives you prepared statements - a safer way of sending data to MySQL and protecting you from SQL injection. This alone should be enough for always choosing MySQLi over MySQL. MySQLi enables most of the MySQL features.
What are the functions of MySQLi?PHP MySQLi Functions. Should I use MySQLi or MySQL?MySQLi supports both procedural interfaces and object oriented interfaces while MySQL supports only procedural interfaces. MySQLi supports stored procedure but MySQL does not. There is enhanced security and improved debugging features in MySQLi where this is comparatively lagging in MySQL.
Is MySQLi faster than MySQL?According to all the Google results for benchmarks linked by ceejayoz it looks like MySQL is at least slightly faster than MySQLi in all the benchmark tests.
|