From http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php I got:
SQL injection refers to the act of someone inserting a MySQL statement to be run on your database without your knowledge. Injection usually occurs when you ask a user for input, like their name, and instead of a name they give you a MySQL statement that you will unknowingly run on your database.
I read the whole article but I still have some major issues understand what it is and how can it be done.
In the first example, what will they actually see?
As far as i understood, if I actually echo $name, the will see all the names because it will always "be true" am I correct?
The other thing I dont understand is whether THE MySQL injection problem is solved with mysql_real_escape_string(), there has to be more to it.
What I really dont get is that mysql_real_escape_string() is made to solve that issue, why isn´t this done automatically, I mean is there a reason you have to add every time mysql_real_escape_string(), is there cases when you should use it and thats why they dont make this automatic?
I hope the question is clear enough, maybe my luck of understanding of the topic makes the question confusing so please ask for any clarification if necessary!
Thanks in advance!!