That's not good.
That is a common problem. Look at text books e.g. PHP how they use databases. Horrible! You must present coder from the get go with prepared statements. if not they learn it wrong because from the beginning "it just works". Some with local, unchecked buffers in C/C++. If the examples are bad so are coders using them.
To be fair, I think the insecure PHP functions are now deprecated.
stackoverflow is a love and hate with me.
I prefer to research answers. I don't like asking questions without doing my own research first.