mysql_connect and mysqli_connect

General discussions related to php

Moderators: macek, egami, gesf

manishrathi
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Oct 19, 2012 3:15 pm

mysql_connect and mysqli_connect

Postby manishrathi » Fri Oct 19, 2012 3:23 pm

whats difference between mysql_connect and mysqli_connect ?

In my script, when I used mysql_connect for connecting with database, it did not work, but when I used mysqli_connect, I coulkd connect with database. So whats the difference and why are there two ?

I saw in some sample scripts online that they have used mysql_connect. So when to use mysql_connect and when to use mysqli_connect ?

Thanks

MeroD
New php-forum User
New php-forum User
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Re: mysql_connect and mysqli_connect

Postby MeroD » Sun Oct 21, 2012 11:11 pm

Please, don't use mysql_* functions for new code. They are no longer maintained and the community has begun the deprecation process. Instead you should learn about prepared statements and use either PDO or MySQLi.

http://stackoverflow.com/questions/7206 ... with-mysql
http://php.net/manual/en/mysqlinfo.api.choosing.php
http://wiki.hashphp.org/PDO_Tutorial_fo ... Developers


Return to “PHP General”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest