hi guys

as the title

which is the best in security mysql_connect() or mysqli_connect()

and which one you prefer

thank you for help or suggestion .

They are different databases, if you use mysql you will use mysql_connect.

or you can use mysql_pconnect to hold the connection, if you want it more secure throw in an @ symbol
@mysql_connect() - this is so it won't display an error

thanks Mr metalix

but as you say the both is the same in secure ?

There is no big difference between Mysql and Mysqli.
Mysqli is nothing but an improved extension of Mysql which supports OOPS.
In some blogs and benchmark says that Mysql is slightly faster than the Mysqli Extension.

There are major difference between the Mysql and Mysqli extensions.

Unless you're using MySQL < 4.1 or PHP 4 you should be using the mysqli extension, even if you're using the procedural version of it. There is NO reason to be using the mysql extension, it is not receiving active development (only maintenance) releases and it can not utilize any of the new MySQL features since 4.1 (5.0, 5.1, and 5.5 have all been stable releases since), such as character sets, prepared statements, multiple statements, transactions, enhanced debugging, embedded server support etc.

Mysqli is also the suggested extension to be used for all new development.

Well, there is really no difference. They both do thesame thing just different ways of saying thesame thing. As improvement comes, u want to improve on an older method.

Meanwhile, not all web servers are implementing mysqli (which is a php5 way) anyway.

If you are used to mysql like me, then go ahead and get used to it...until web servers says otherwise