diff --git a/dblayer.php b/dblayer.php index 50822b8..ed84872 100644 --- a/dblayer.php +++ b/dblayer.php @@ -635,6 +635,12 @@ class dblayer extends PDO $display = array_keys ($this->fields); } + $foreignSelectCols = array (); + if ($foreignSelect !== null) + { + foreach ($foreignSelect as $s) + $foreignSelectCols[] = $s[0]; + } $req = "SELECT $this->sep"; $req .= implode ("$this->sep,$this->sep", $display); $req .= "$this->sep "; @@ -648,6 +654,9 @@ class dblayer extends PDO // TODO Allow a field=>value in plus of array("field","value") foreach ($select as $n=>$s) { + // The foreign keys can not be in the select too (conflict) + if (in_array ($s[0],$foreignSelectCols)) + continue; if ($n > 0) { if ($whereOr === false)