I am trying to use an sql query but i get multiple times the same result.
I read that i have to use an INNER JOIN or a LEFT JOIN to avoid that. The only problem is that i am a bit newbie with mysql so i can’t actually make a successful query.
The query is this
SELECT *
FROM table1,table2
WHERE table1.name LIKE '%$str%'
OR
table1.last_name LIKE '%$str%'
$str is a string that i pass in a php function in order to make a search.
You need to make a join between those two tables.
You should also protect against SQL injection by using
mysql_real_escape_string.Here is the documentation on the escape string.