SELECT a.id, a.title, a.seo, a.description, a.validate, ai.src
FROM category as c, category_advert as ca, adverts as a
LEFT JOIN advert_imgs as ai ON ai.main = 1 and ai.id_adv = a.id
WHERE MATCH(a.title, a.keywords, a.description, a.textAdvert) AGAINST ('*appartamento*' IN BOOLEAN MODE) and a.validate = 1
ORDER BY `title` ASC
SELECT u.id, u.onlineSatus, ud.user_img, ud.name, ud.lastname, ud.about
FROM tori_users as u, tori_user_date as ud
WHERE MATCH(u.login, u.email, ud.name, ud.lastname, ud.mobile, ud.about, ud.company_name, ud.patent) AGAINST ('alex' IN BOOLEAN MODE) and u.validStatus = 1 and u.id = ud.user_id
UNION
SELECT p.id, p.portfolio_img, p.name, p.lastname, p.about, u.onlineSatus
from tori_portfolio as p, tori_users as u
where MATCH(p.name, p.lastname, p.about) AGAINST ('alex' IN BOOLEAN MODE) and search_status = 0 and u.validStatus = 1 and u.id = p.id_user
UNION
SELECT a.id, a.seo, a.title, a.description
FROM tori_adverts as a
WHERE MATCH(a.title, a.description, a.keywords) AGAINST ('alex' IN BOOLEAN MODE) and validate = 1