summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Bergren2008-11-17 17:02:11 (GMT)
committer Brandon Bergren2008-11-17 17:02:11 (GMT)
commite681cf758d8813933cb45b9f1eef62864f1796e0 (patch)
treeaed895949643314fda70deea3b866487a3a767c6
parent6e8d949cf08abb87fef6be914f0b38474e1f5e06 (diff)
#334513 by bangpound: Fix broken query when loading locations with a genid.
-rw-r--r--location.module7
1 files changed, 6 insertions, 1 deletions
diff --git a/location.module b/location.module
index 1c9f9b2..1037a6e 100644
--- a/location.module
+++ b/location.module
@@ -883,7 +883,12 @@ function location_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
* @return An array of loaded locations.
*/
function location_load_locations($id, $key = 'vid') {
- $result = db_query('SELECT lid FROM {location_instance} WHERE '. db_escape_table($key) .' = %d', $id);
+ if ($key == 'genid') {
+ $result = db_query('SELECT lid FROM {location_instance} WHERE '. db_escape_table($key) ." = '%s'", $id);
+ }
+ else {
+ $result = db_query('SELECT lid FROM {location_instance} WHERE '. db_escape_table($key) .' = %d', $id);
+ }
$locations = array();
while ($lid = db_fetch_object($result)) {
$locations[] = location_load_location($lid->lid);