It is well known that questions using mysql_*
on Stack Overflow have been getting the canned
Please, don't use
mysql_*
functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.
treatment.
So when I came across this question with almost 60 thousand views and all of the answers referenced the old (soon to be removed) mysql_*
extension for php I thought that a new answer should be put there to show what one should do currently as opposed to editing the answer that was currently accepted and layed untouched for 3 years.
I stupidly asked chat to upvote my answer and downvote the current accepted answer (which is what was done for other answers that have come deprecated and in need of being replaced).
Instead of people helping me out, I was berated and told that I should not have done that etc.
I even got a comment on my answer asking why I did not edit the original accepted answer.
I did not feel that editing a really old answer was acceptable, especially changing it that much!
If I was wrong on my approach i will gladly delete my answer and edit the accepted one, I am just asking for what should have been the correct thing for me to do (when it came to that question, not to chat) and what should be done in the future if a user finds an outdated accepted answer.
mysql_*
used in answers (or possibly just the answers of canonical questions) to newer counterparts are acceptable edits then that's that communities prerogative.PHP: how to get last inserted ID of a table?
leads to the canonical manual entries for bothmysql_*
and PDO. But seeing as our overlords have denied us the "General Reference" close reason...