What Is MySQLi Connect
What Is MySQLi Connect
What Is MySQLi Connect
If the connection to the database was successful or TRUE, the connection is returned,
and you can begin interacting with the database. On the other hand, if the connection
was unsuccessful or FALSE, you’ll get an error message informing you accordingly.
Syntax
Now, let’s take a look at the syntax for using the MySQL_Connect() function properly:
1 mysql_connect(hostname,username,password,databasename);
Now, from a PHP perspective, you can connect your PHP website or
application to a MySQL database using the PHP MySQL Connect
function accordingly.
\
PHP MySQL_Connect() Syntax
1 <?php
2 $mysql = new mysqli("hostname", "username", "password", "databasename");
3 ?>
MySQL_Connect vs MySQLI_Connect
With this in mind, you may have come across the MySQLI_Connect
function and rightfully wondering what’s the difference between
it and the MySQL_Connect function.
So for example:
..and so on.
Of course, the above is a simplistic approach on how to change
MySQL to MySQLI. Furthermore, you must check all parameters of
the different function calls in your code to make sure any
differences are addressed.
Is MySQL_Connect Deprecated?
Final Thoughts