Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

mysql_connect and mysqli_connect

General discussions related to php

Moderators: macek, egami, gesf

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
manishrathi
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Oct 19, 2012 3:15 pm

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
MeroD
New php-forum User
New php-forum User
 
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron