18

If a beginner searches on Google about PHP and MySQL, they mostly get the links below, at least according to Google in my country/area:

These are some examples of what I got while searching on Google about the same, as you can see, the accepted answers mostly reflect the usage of deprecated MySQL functions. Which trick the beginners to use the functions as they are on Stack Overflow.

This has already been discussed here and comments are made below to warn users about the deprecation, but still some users practice the methods of accepted answers which follow bad practices.

We don't want beginners to make these big mistakes, we are SO and Stack Overflow is a wiki so it should be updated, not to mislead beginners into using deprecated functions and methods.
I still see people posting questions about the errors and we notice that they are using old MySQL functions that are prone to SQL injections. Although most of the sources are now updated and are new, these old ones need attention and we should do something about them

Feature Request

Can Stack overflow provide a option to mark a warning sign on deprecated accepted answers (or those which are voted highly) so the visitors don't get mislead by the information?

17
  • 1
  • 2
    @user202729 totally the thing which you should do but nowdays, beginners don't scroll down to see what else is there, they only check out the accepted answer which popups to the top. We should do something about the old accepted answers and the most voted one
    – weegee
    Commented Apr 11, 2019 at 9:52
  • See the views and the upvote ratio on the questions I linked above, they just search it on google, copy the code and run it and it's okay if they are doing that for any reason that's why we should do something about the answers @user202729
    – weegee
    Commented Apr 11, 2019 at 9:58
  • 1
    @user202729 this one is more relevant meta.stackexchange.com/q/261817/213575
    – Braiam
    Commented Apr 11, 2019 at 11:39
  • 1
    @window.document it is not our business that people commit self-sabotage. If people only read the accepted answer, then let them fail.
    – Gimby
    Commented Apr 11, 2019 at 15:37
  • 1
    It is somewhat not their mistake also, accepted answers are accepted for a reason @Gimby which confuse them.
    – weegee
    Commented Apr 11, 2019 at 15:43
  • 2
    Playing Devil's Advocate for a second - are we really responsible if someone copies code from the Internet with the assumption that it will work and is good?
    – Makoto
    Commented Apr 11, 2019 at 17:33
  • 3
    No we are not, but if they copy it from SO..... I don't know what to say about that, but as the members of this community, I think we should keep our references, that popup to the front page of any search engine, fresh and updated. Just for SO's quality. @Makoto
    – weegee
    Commented Apr 11, 2019 at 17:47
  • 2
    I don't disagree, but I've observed people actually taking the first few things they found on Stack Overflow - in some cases, the question portion - and trying to use that to solve their problem. It does indicate to some degree that people aren't leveraging the tool to its maximum effectiveness and aren't looking critically to other answers...but I still don't feel like we're directly responsible for that. All we can do is provide better answers. It's up to those who are looking to find them.
    – Makoto
    Commented Apr 11, 2019 at 17:50
  • 3
    @Makoto you made a very good point there. No one is responsible for that issue and I'm not blaming anyone but I don't think that we should even keep deprecated answers on SO. Yes we have good, updated answers lying below the accepted answers in terms of votes. Some users also think that votes mean quality so they choose the old answers with most votes. It should be updated .
    – weegee
    Commented Apr 11, 2019 at 17:56
  • We cannot do anything about the problem except for the things already mentioned in the old meta posts; however if there's enough push from the "community" the SE company might implement one of the feature requests.
    – user202729
    Commented Apr 12, 2019 at 5:58
  • 6
    Arguing whether it's our fault or viewers being confused by the wrong sort order etc. doesn't help here, but we should all agree that making content better is a good thing.
    – user202729
    Commented Apr 12, 2019 at 5:59
  • @user202729 what we should do about it? Edit them or remove them completely?
    – weegee
    Commented Apr 12, 2019 at 15:55
  • 1
    Can SO add a feature where we can display a warning panel at the top of a question or an answer when either of them are very version specific? This is not just MySQL I often find questions that are relevant to current versions but now must be solved in different ways. What I am expecting is that SO provides a wizard for making these sort of edits in a standard way. Commented Apr 13, 2019 at 2:32
  • is it possible to mark those questions as duplicates of another? We could make a canonical Q&A about the deprecation of those functions, the new alternatives, and why the old functions are dangerous and then simply make the old Q&A duplicates of this new question.
    – Polygnome
    Commented Apr 14, 2019 at 7:48

2 Answers 2

9

From an outsider point of view, if I googled something, and saw these answers, one of two things would happen:

  • I would recognize that these are poor solutions, which would damage my personal opinions about the reputation of SO
  • I implement these solutions (Which in this case, will not work in recent versions of PHP) and either be upset now, or later, at the results, which would damage my personal opinions about the reputation of SO

Anyone looking for solutions to basic items like querying a DB in PHP is likely to not read the comments on an answer. As soon as the solution is presented to them, they will likely implement that solution and go no further, which is why these answers are dangerous. The old mysql functions are deprecated for a reason.

As soon as a beginner finds a solution, they may not know any better than to just take that solution and use it. They may not read any newer answers, and newer answers may not even go to the top of the thread where they may see it, so adding a "Updated [current year/version]" answer isn't the best course of action either.

Ideally, there would be a system in place to mark an answer as deprecated. In software, things change, and a software wiki should be flexible to that. But then, the question becomes, how do we provide a new accepted answer? The user who created the original question would need to interact with the question once again to accept an up-to-date answer (Which, in many cases, will not be possible), or the community would need to vote on an answer, and at what point of community approval does an answer become "accepted"?

But in the short term, I am behind removing or archiving these questions.

12
  • 1
    The "deprecated answer" suggestion had been suggested 4 years ago.
    – user202729
    Commented Apr 13, 2019 at 3:37
  • About "archive": if I understood correctly, that means no more answer can be posted, which is not a good thing. About "remove": even obsolete answer can be useful sometimes. We don't want those information to be removed.
    – user202729
    Commented Apr 13, 2019 at 3:38
  • @user202729 Archiving a question would also hide it from the public, but not remove it from an asker or answerer's account. And obsolete answers arent always useful, and are sometimes harmful, which is why this question has been asked.
    – AlgoRythm
    Commented Apr 13, 2019 at 4:12
  • 1
    "Ideally, there would be a system in place to mark an answer as deprecated." -- Kind of like a historical lock? It's not a perfect fit, but it has a lot of the right effects.
    – user149341
    Commented Apr 13, 2019 at 4:31
  • There's a third thing that could happen: I could notice that the question was asked or answered years ago, that the version of MySQL (or whatever) came out after the answer was posted, and realize that the answer might not be current. So I'll look into it more to see if it is either still valid or a newer/better solution exists. Commented Apr 13, 2019 at 5:49
  • @1201ProgramAlarm Interesting, so should the "asked" section along the right hand side become bold and red if asked more than 5 years ago, with a tool tip suggesting the answer may be out of date, and prompting the reader to look for a more recent answer?
    – AlgoRythm
    Commented Apr 13, 2019 at 5:52
  • No. That sort of highlighting can easily be ignored. And the version I am using (i.e. fixing bugs in) could be the old one. It is the responsibility of the searcher to determine if the information they find is good and relevant. Many people are not willing to put the effort into verifying their search results, and you can't really do anything to force them to. This is something they need to learn (just like how to debug stuff). Commented Apr 13, 2019 at 5:59
  • @1201ProgramAlarm true, but giving the reader improved tools to identify older information is better for everyone.
    – AlgoRythm
    Commented Apr 13, 2019 at 6:14
  • @AlgoRythm let's assume that any user is not using the latest versions of php which may happen rarely. Then what? He won't get any errors regarding deprecation? My condition's occurrence is rare but why keep the deprecated answers? Do they help our website? Are they the best solutions?
    – weegee
    Commented Apr 13, 2019 at 10:36
  • Also this is not only for PHP and MySQL but also for the future deprecation of methods and functions too and many other languages.
    – weegee
    Commented Apr 13, 2019 at 10:46
  • @duskwuff no, that's the worst solution. It prevents anyone from ever fixing the question/answer.
    – Braiam
    Commented Apr 13, 2019 at 15:02
  • @AlgoRythm Then that's no different from deleting the question (with regard to the readers). Not a good thing. (also, deletion also keeps the Q&A visible to the posters)
    – user202729
    Commented Apr 14, 2019 at 6:59
2

Simply mark them as legacy answers.

How could any website completely automate determining if a user doesn't know better and if a user is in a situation in which they must provide legacy support?

I revise blog entries and use a .fade class along with a warning at the top. As long as the visitor acknowledges that the information is outdated they can remove the .fade class easily enough. It's the simplest solution.

Additionally I'd recommend simply linking to newer / more relevant threads for the majority of people who would be looking for current information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .