forked from extern/egroupware
"fixed ambiguous column sql-error by adding table-name to id over which we join"
This commit is contained in:
parent
928a38d5cf
commit
a45ea03b19
@ -919,6 +919,11 @@ class so_sql
|
||||
}
|
||||
if ($extra_cols) $colums .= ($colums ? ',' : '').(is_array($extra_cols) ? implode(',',$extra_cols) : $extra_cols);
|
||||
|
||||
// add table-name to otherwise ambiguous id over which we join (incl. "AS id" to return it with the right name)
|
||||
if ($join && $this->autoinc_id && strpos($colums,$this->autoinc_id) !== false)
|
||||
{
|
||||
$colums = preg_replace('/([ ,]+)'.preg_quote($this->autoinc_id).'([ ,]+)/','\\1'.$this->table_name.'.'.$this->autoinc_id.' AS '.$this->autoinc_id.'\\2',$colums);
|
||||
}
|
||||
$num_rows = 0; // as spec. in max_matches in the user-prefs
|
||||
if (is_array($start)) list($start,$num_rows) = $start;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user