use mysqli or PDO

Problems with the Windows version of XAMPP, questions, comments, and anything related.

use mysqli or PDO

Postby tovindra » 04. December 2014 05:43

I got this error whenever i run my program. "mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in c:\xamp......."
tovindra
 
Posts: 1
Joined: 04. December 2014 05:33
Operating System: Windows XP

Re: use mysqli or PDO

Postby JJ_Tagy » 04. December 2014 06:03

Since I don't see a question, I assume you think something is wrong. This is just a warning, but I recommend switching to mysqli ("i" being "improved"). http://php.net/manual/en/mysql.php
JJ_Tagy
 
Posts: 788
Joined: 30. January 2012 13:44
XAMPP version: 5.5.15
Operating System: Windows 10 Pro x64

Re: use mysqli or PDO

Postby Altrea » 04. December 2014 07:23

I (and most php professionals) recommend switching to PDO, because:
  • it can do everything mysqli can do too, and more
  • it has a far better error handling (option to use exceptions)
  • it has the advantage to switch the database driver if needed. So if you need to switch from MySQL to Oracle, MS SQL, PostgreSQL, SQLite, ..., you can do this with a minimum of changes
  • it can use named parameters
  • It has an OOP syntax only
  • [...]

But the syntax of PDO is more different to mysql than mysqli is

If your question is, if you have to change to provide your application is running even on future php versions, than the answer is yes. You only need to choose which one you prefer.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 149 guests