| 
 Posted by Mike Scougall on 02/04/06 18:37 
"UKuser" <spidercc21@yahoo.co.uk> wrote in message 
news:1139067499.480592.296550@g44g2000cwa.googlegroups.com... 
> Thanks for that. Different error now: 
> 
> MySQL error 1064: You have an error in your SQL syntax. Check the 
> manual that corresponds to your MySQL server version for the right 
> syntax to use near 'BETWEEN lowerval AND upperval' at line 1 
> 
 
This line -- 
>    $query = "SELECT result FROM fig_lookup WHERE $price BETWEEN 
> lowerval AND upperval"; 
 
Should be -- 
    $query = "SELECT result FROM fig_lookup WHERE " . $price . " BETWEEN 
lowerval AND upperval"; 
 
But the real problem is that $price is undefined at this point. 
PHP code is run, and all it's variables evaluated, on the server-side before 
the page is sent to the browser. 
$price is set here in the form on the client-side after the PHP code is run 
and results rendered. 
 
Try this instead -- 
$query = ""; 
if (isset($_POST['price']) ){ 
   $price = $_POST['price']; 
   $query = "SELECT result FROM fig_lookup WHERE " . $price . "BETWEEN 
lowerval AND upperval"; 
} 
 
....and you probably left it out, but I don't see where you actually call 
function result_get(); 
 
HTH 
 
------------------------------------ 
Mike S 
Copywriting for the IT Professional 
www.redmaplesoftware.com
 
  
Navigation:
[Reply to this message] 
 |