Hi All,

I'm having a problem with a query - which is based on conditional user inputs. In all circumstances, the outputted query ALWAYS works in phpmyadmin returning rows where applicable, but not always in php. No errors are displayed, with error reporting set at E_ALL, and mysql_error hasn't been invoked.

Here is my an example query which works only in phpmyadmin, returning rows. But not php.

SELECT * FROM product p LEFT JOIN product_info pi ON p.product_id=pi.product_id LEFT JOIN product_param pp ON p.product_id=pp.product_id WHERE spherelowneg<=-5 AND spherehighneg>=-5 AND sphere_low<=5 AND sphere_up>=5 AND cyllowneg<=-5 AND cylhighneg>=-5 AND cyllowneg<=-5 AND cylhighneg>=-5 AND axis_low<=160 AND axis_high>=160 AND axis_low<=70 AND axis_high>=70 AND pd_low<=60 AND pd_high>=60

in php, the query looks like this

$db=mysql_query("SELECT * FROM product p LEFT JOIN product_info pi ON p.product_id=pi.product_id LEFT JOIN product_param pp ON p.product_id=pp.product_id 
WHERE $spherelow<='$sphere' AND $spherehi>='$sphere'
AND $spherelowl<='$spherel' AND $spherehil>='$spherel' 
AND $cylfieldlow<='$maxcyl' AND $cylfieldhigh>='$maxcyl' 
AND $cylfieldlowl<='$maxcyll' AND $cylfieldhighl>='$maxcyll' 
AND axis_low<='$maxaxis' AND axis_high>='$maxaxis'
AND axis_low<='$maxaxisl' AND axis_high>='$maxaxisl'
AND pd_low<='$maxpd' AND pd_high>='$maxpd'") or die(mysql_error());

Any Ideas why this might be? I realise the query below checks columns several times.

Many Thanks

If you echo your query in php, and try it in phpmyadmin, does it yield results ?

Yeah, it returns rows every time. All the values are escaped in php also.

So what happens next in code? Perhaps the issue is after the query.