Passing parameter to mysql query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mutuah
Forum Newbie
Posts: 3
Joined: Tue Feb 26, 2008 7:54 am

Passing parameter to mysql query

Post 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?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Passing parameter to mysql query

Post 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.
mutuah
Forum Newbie
Posts: 3
Joined: Tue Feb 26, 2008 7:54 am

Re: Passing parameter to mysql query

Post by mutuah »

Hi everyone, pls dont bother. I sorted the problem. Thanks to those who viewed the post.
Post Reply