Page 1 of 1

Passing parameter to mysql query

Posted: Tue Feb 26, 2008 8:02 am
by mutuah
Scottayy| Please use

Code: Select all

and
when posting code in the forums.[/color]

Please help:
How can i pass the parameter below to an sql query?

Code: Select all

$searchItem = $_REQUEST['searchItem'];
 
$sql = "SELECT committee_name, decision.decision_id, decision_date,
    indicator_name, indicator_status, indicator_remark
        FROM committee, decision, indicator
        WHERE decision.committee_id = committee.committee_id
        AND decision.decision_id = indicator.decision_id
        AND decision.committee_id = indicator.committee_id
    AND decision_name LIKE '%$searchItem%'
        ORDER BY decision.committee_id ";
Whenever i query, i get 0 records. Where am i going wrong?

Re: Passing parameter to mysql query

Posted: Tue Feb 26, 2008 8:27 am
by Zoxive
Echo your query string, then copy and paste that into mysql (CLI/phpmyadmin) and see what it selects, and what is written incorrectly.

Re: Passing parameter to mysql query

Posted: Wed Feb 27, 2008 12:04 am
by mutuah
Hi everyone, pls dont bother. I sorted the problem. Thanks to those who viewed the post.