I agree that the topic of the question was too broad. I don't think that Programmers.se will receive it any better.
You were given three links in the comments of your question on the main site. Check those out.
You already know what terms to search for, and it appears that you're already researching it from your comment on the main site:
I am aware of stuff like mysqli_real_escape_string(), but I want to
see examples on how to use it.
You're on the right track! Now find some examples and read the explanations of how/why they work to stave off SQL injection.
If you get stuck, then come back to the main site, post code showing what's bugging you, and you'll get help.
The more specific the questions, the better.