What is difference between the new mysqli
and mysqli_connect
?
I know that executing a query is different;
for example: mysqli->query()
and mysqli_query()
Why are there two different types, what is the need for the difference?
One is for Procedural style programming and other is for OOP style programming. Both serve the same purpose; Open a new connection to the MySQL server
OOP Style usage
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
Procedural Style usage
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
Reference: PHP Manual