Jump to content

Help need regarding mysql_query function


phani_kosaraju

Recommended Posts

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 [email protected]

Thanks in Advance.

So is the database incorrectly set up wrong, are you selecting NOT NULL when the tables where first created?

 

Can be NULL or NOT NULL set only, switch try again?

 

Dont see the problem, if mysql says it ok in phpmyadmin?

 

 

 

look at your mysql join again, brake it down, and look hard, looks wrong to me?

 

"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"

 

how can a id match a name weird?

c.plan_id = a.policy_name ((unless policy name is not a int(number

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.