Connect PHP with MySQL through mysqli_connect

This time I will show you how to make a simple connection with PHP and MYSQL using the PHP extension for mysqli databases since “mysql_connect” that was used in PHP4 and at the beginning of PHP5 has become obsolete, let’s start with the example:

I will explain some details of the presented code
1- Once the connection is made, some methods are available, such as query ($ connection-> query ($ query);) with which we have made our query after having established our connection.

2- Through while ($ row = mysqli_fetch_array ($ result)) we iterate through each of the elements of our array obtained from the query.

3- With the variable plus the name of the field we can obtain its value ($ row [“field_name”])

I hope it will be useful later.

CC BY-NC-ND 4.0 Connect PHP with MySQL through mysqli_connect by QualityInfoSolutions is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Contáctenos