naike Posted October 16, 2010 Share Posted October 16, 2010 Hey. I was writing my class object for a database connection and while I was writing the query part, I came to wonder whether I should use mysql_real_escape_string or mysqli_real_escape_string to make the query mysql friendly, what's the difference? Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/ Share on other sites More sharing options...
Alex Posted October 16, 2010 Share Posted October 16, 2010 Stick to one set. Use either all mysql_* or mysqli_*, don't mix and match them. Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122646 Share on other sites More sharing options...
naike Posted October 16, 2010 Author Share Posted October 16, 2010 Stick to one set. Use either all mysql_* or mysqli_*, don't mix and match them. So they are exactly the same? Whats the point in having those 2? And does one of those have an advantage over the other? Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122650 Share on other sites More sharing options...
Alex Posted October 16, 2010 Share Posted October 16, 2010 MySQLi is the MySQL Improved extension. Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122651 Share on other sites More sharing options...
naike Posted October 16, 2010 Author Share Posted October 16, 2010 Is there any difference between them? I cant find any information about these functions being different. Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122653 Share on other sites More sharing options...
Alex Posted October 16, 2010 Share Posted October 16, 2010 There wouldn't be two different extensions if they were the same, would there? MySQLi The API is more or less the same, if that's what you're asking. With the addition of an Object-Oriented style. Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122654 Share on other sites More sharing options...
gizmola Posted October 16, 2010 Share Posted October 16, 2010 Use mysqli. It allows among other things for you to use prepared statements and bind parameters. There are a number of reasons to use them, not the least of which is that bind params eliminate concerns about sql injections. Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122678 Share on other sites More sharing options...
naike Posted October 16, 2010 Author Share Posted October 16, 2010 Are they used just like normal mysqli functions with same arguments? So for mysql_connect i would simply use mysqli_connect Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122692 Share on other sites More sharing options...
BlueSkyIS Posted October 16, 2010 Share Posted October 16, 2010 http://lmgtfy.com/?q=php+mysqli+example Link to comment https://forums.phpfreaks.com/topic/215986-mysql-and-mysqli/#findComment-1122726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.