mysql_query function problem

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
phanikrishna
Forum Newbie
Posts: 1
Joined: Fri Sep 25, 2009 4:29 am

mysql_query function problem

Post by phanikrishna »

Hi All,

I am generating one query dynamically in php, that query looks like this

"SELECT sum(a.premium_amt), c.base_premium FROM policy_holders a, policy_status b, ins_plans c WHERE a.login_date <= '$lastDate' AND b.ph_id = a.ph_id AND b.issued_date <= '$issue' AND b.ph_status = 2 AND a.ro_id = '".$ro_id."' AND programecode = 4 AND a.policy_name = ".$policy_row['0']." AND c.plan_id = a.policy_name"

when i am echoing the query it is showing that query, if i copy that query and run in phpmyadmin it is producing good and correct results. But if i run the same query by using mysql_query function it is giving null values. if you remove a.ro_id = '".$ro_id."' or programecode = 4 or b.ph_id = a.ph_id From that query then it is running perfectly in mysql_query function. But i need to have that condition.

If you need any clarification regarding my problem ping me in gtalk at phanikrishna@webkuteer.com
Thanks in Advance.
Post Reply