sql query problems
Posted: Mon Oct 12, 2009 3:34 pm
Hi all,
Having a problem with a sql query in an action:
This works:
$sql = "select mayor_name,city_name from cityinfo where county_name = 'some-county'";
This doesn't:
$sql = "select mayor_name,city_name,(round(sqrt((pow(( $x_pos - x_pos ),2) + (pow(( $y_pos - y_pos),2))))) as Distance from cityinfo where county_name = 'some-county'";
The error I get is:
[12-Oct-2009 18:37:25] PHP Fatal error: Call to a member function db() on a non-object in /ebs01/html/Salient/actions/neighbors.php on line 15
Any idea what is wrong with the above query? It executes as expected when cut and pasted directly into a mysql prompt (the only difference being $x_pos and $y_pos are changed to actual values in the mysql prompt.)
Thanks!
Having a problem with a sql query in an action:
This works:
$sql = "select mayor_name,city_name from cityinfo where county_name = 'some-county'";
This doesn't:
$sql = "select mayor_name,city_name,(round(sqrt((pow(( $x_pos - x_pos ),2) + (pow(( $y_pos - y_pos),2))))) as Distance from cityinfo where county_name = 'some-county'";
The error I get is:
[12-Oct-2009 18:37:25] PHP Fatal error: Call to a member function db() on a non-object in /ebs01/html/Salient/actions/neighbors.php on line 15
Any idea what is wrong with the above query? It executes as expected when cut and pasted directly into a mysql prompt (the only difference being $x_pos and $y_pos are changed to actual values in the mysql prompt.)
Thanks!