Is mysql_connect() usable in PHP 5.6.5 [duplicate]
Asked Answered
L

1

11

Which is the latest version PHP version, who support mysql_connect()?

I've want to upgrade my PHP version. I've read, that mysql_connect() are deprecated. In all Projects I've use the old mysql_connect(). Can I update to PHP 5.6.5 or is the command in this version removed already?

Uses somebody PHP 5.6.5 with mysql_connect()?

Problem is, that I can't change sooo much Projects in this short time and could only update to the highest version, which support mysql_connect().

Best regards and many thanks!

Liggitt answered 28/1, 2015 at 20:57 Comment(7)
"Is mysql_connect() usable in PHP 5.6.5" - A: No'ish, and error reporting will tell you. Use mysqli_ or PDO. If you get a warning, then you'll have no choice but to switch.Teague
It's still available in 5.6.x, with depreciation notice. In future versions it's likely to become an external PECL module.Byssinosis
To answer the question at hand, there is a piece of code I remember seeing on Stack/web that will detect whether the functions are deprecated and if so, use the respective API. You just need to look for it.Teague
Sorry! I don't find the same question with answer. I've read, that I'll get a deprecation notice. But if I get a notice, then I could use the function?! In future I will/must use the mysqli, but I must take an update now and must use the php version, where mysql_connect() are usuable (notices I can deactivate). But I can't change sooo many codelines to mysqli_* in this short time....Liggitt
Instead of just changing it all to mysqli_ directly, create your own database class that uses mysqli_ inside, so when you decide to finally move to PDO you only have to change the internals of that wrapper and not every page's code.Ob
Now I found my answer in one of the answers of your linked thread (#12860442). I've don't look at these question, because I thought, this question is still another one and too generally. It seems, that I could use mysql_connect() to 5.7. ;-)Liggitt
@Ob correct! all new projects uses an own sql class. but the old projects are coded hard and I can't update the server and tomorrow I must change 100 projects with a few thousends codelines... - it isn't possible. therefore I asked in which version the mysql_connect() isn't usable anymore... :-)Liggitt
P
8

http://php.net/manual/en/function.mysql-connect.php

5.5.0 This function will generate an E_DEPRECATED error.

don't try to use any mysql_* functions as they are deprecated and dangerous. See mysqli_ functions instead.

Prophylactic answered 28/1, 2015 at 21:2 Comment(7)
Very well formatted "comment". Wish I could do that in one.Teague
PDO is preferable to MySQLi IMHO.Cletis
UV, huh ? - wow, wish I'd of put my comment as one. I'd of gotten 2 also! wow Edit: Make that 3.Teague
There is no need to be sarcastic and mean. I was writing this comment the same time as you were.Prophylactic
Questions like these shouldn't have answers, IMHO. They're all over Stack and the web. I mean come on, really. Plus, PHP 5.6 - mysql_ to be deleted in future releases. 5.6 IS a future release.Teague
I think the OP already knew all the info in this answer. They were asking for a way around these facts.Ob
@Ob Therefore not "answering" the real question asked.Teague

© 2022 - 2024 — McMap. All rights reserved.