MySQL Forums
Forum List  »  PHP

Too many results in my Query
Posted by: Bruce Banner
Date: November 09, 2012 02:09PM

I have this query that is supposed to limit the results to ones that match the keyword. However, some results do not contain that key word but show up anyway. Is there something wrong with my syntax here?

Thank you!!

$keyword = $_POST['keyword'];

$q = "SELECT * FROM user_info INNER JOIN project ON user_info.user_id = project.user_id LEFT JOIN bedsize ON project.bedsize_fk = bedsize.bedsize_id LEFT JOIN topics_of_improv ON project.p_id = topics_of_improv.p_id LEFT JOIN medication ON topics_of_improv.medication_fk = medication.med_id LEFT JOIN care_trans ON topics_of_improv.care_trans_fk = care_trans.care_trans_id LEFT JOIN hosp_acquired_infect ON topics_of_improv.hosp_acquired_infect_fk = hosp_acquired_infect.hai_id LEFT JOIN hosp_patient_care_pro ON topics_of_improv.hosp_patient_care_pro_fk = hosp_patient_care_pro.hpcp_id LEFT JOIN health_it ON topics_of_improv.health_it_fk = health_it.health_it_id LEFT JOIN teamwork ON topics_of_improv.teamwork_fk = teamwork.teamwork_id LEFT JOIN project_diss ON topics_of_improv.project_diss_fk = project_diss.project_diss_id LEFT JOIN resources ON topics_of_improv.resources_fk = resources.resources_id LEFT JOIN summary ON project.p_id = summary.p_id LEFT JOIN process
ON summary.process_fk = process.process_id
WHERE (project.description LIKE '%" . $keyword . "%'
OR summary.improvement LIKE '%" . $keyword . "%'
OR summary.interventions LIKE '%" . $keyword . "%'
OR summary.brief LIKE '%" . $keyword . "%'
OR summary.lessons LIKE '%" . $keyword . "%'
OR summary.actions LIKE '%" . $keyword . "%'
OR summary.measures LIKE '%" . $keyword . "%'
OR summary.clinical LIKE '%" . $keyword . "%')

Options: ReplyQuote

Written By
Too many results in my Query
November 09, 2012 02:09PM
November 12, 2012 12:45AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.