Use mySQLi in your queries
Once you have enabled and configured mySQLi, you can use it in your PHP code to execute queries on MySQL databases. There are two main ways to use mySQLi: procedural and object-oriented. The procedural style is similar to the old mysql extension, but with some differences in syntax and function names. The object-oriented style is more modern and elegant, and uses classes and methods to interact with MySQL servers.
To use the procedural style, you need to use the mysqli_connect() function to establish a connection to a MySQL server, passing the host, user, password, and database name as parameters. For example: $link = mysqli_connect("localhost", "user", "password", "database"); Then, you can use the mysqli_query() function to execute a query on the database, passing the connection and the query string as parameters. For example: $result = mysqli_query($link, "SELECT * FROM table"); You can also use other functions to fetch, process, and free the result set, such as mysqli_fetch_assoc(), mysqli_num_rows(), and mysqli_free_result(). To close the connection, you can use the mysqli_close() function.
To use the object-oriented style, you need to create an instance of the mysqli class, passing the host, user, password, and database name as parameters to the constructor. For example: $mysqli = new mysqli("localhost", "user", "password", "database"); Then, you can use the query() method to execute a query on the database, passing the query string as a parameter. For example: $result = $mysqli->query("SELECT * FROM table"); You can also use other methods and properties to fetch, process, and free the result set, such as fetch_assoc(), num_rows, and free(). To close the connection, you can use the close() method.
Both styles offer the same functionality, but the object-oriented style is more concise and consistent. You can choose the one that suits your preference and coding style.