I have this query that is taking information from two different databases:
I’m using $query as the query string.
SELECT
blurbs.text,
blurbs.timestamp,
users.name,
users.username,
users.profilepic,
users.id
FROM
blurbs, users
WHERE
(LOWER(blurbs.text) LIKE '%$query%'
OR LOWER(users.name) LIKE '%$query%')
AND blurbs.is_private=0
LIMIT 0,30
I am receiving duplicates of some of the entries in the blurbs database.
How can I fix this?
You have not joined both tables. You need to join it something like
users.id = blurbs.userid:So your query should be:
Or you can also use join statement like this: