Prevents potential wrong query.
authorStéphane Jacob <sj@m4x.org>
Sat, 3 Jul 2010 17:04:11 +0000 (19:04 +0200)
committerStéphane Jacob <sj@m4x.org>
Sat, 3 Jul 2010 17:04:11 +0000 (19:04 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
include/validations/entreprises.inc.php

index bf60594..47e6a02 100644 (file)
@@ -68,12 +68,14 @@ class EntrReq extends ProfileValidate
                 $where .= "name LIKE '%" . $name_array[$i] . "%'";
             }
         }
-        $res = XDB::iterator('SELECT  name
-                                FROM  profile_job_enum
-                               WHERE  ' . $where);
-        $this->suggestions = "| ";
-        while ($sug = $res->next()) {
-            $this->suggestions .= $sug['name'] . " | ";
+        if ($where != '') {
+            $res = XDB::iterator('SELECT  name
+                                    FROM  profile_job_enum
+                                   WHERE  ' . $where);
+            $this->suggestions = "| ";
+            while ($sug = $res->next()) {
+                $this->suggestions .= $sug['name'] . " | ";
+            }
         }
     }