Fix extra comma in cross-table sql

This commit is contained in:
Miles Lott 2001-02-22 15:05:48 +00:00
parent 27c6cfa741
commit 5c9b01628c

View File

@ -370,11 +370,11 @@
while(list($name,$value)=each($stock_fields)) {
$std .= "a.".$name.",";
}
$std = substr($std,0,-1);
//$std = substr($std,0,-1);
while(list($name,$value)=each($extra_fields)) {
$ext .= "b.".$name.",";
}
$ext = substr($ext,0,-1);
//$ext = substr($ext,0,-1);
if (!empty($fieldlist2)) {
$filtertemp = " AND " . $filterlist2 . " ";
}
@ -383,6 +383,9 @@
echo "<br>DEBUG - Filtering with: #" . $filtertemp . "#";
}
$qfields = $std . $ext;
$qfields = substr($qfields,0,-1);
if ($query) {
$squery = " AND (n_family like '%$query%' OR n_middle like '"
. "%$query%' OR n_given like '%$query%' OR d_email like '%$query%' OR "
@ -392,8 +395,8 @@
. "org_name like '%$query%')";
}
$sql = 'SELECT a.id,a.tid,a.lid,a.owner,b.id,'. $std . ','
. $ext . ' FROM '.$this->std_table.' AS a, '
$sql = 'SELECT a.id,a.tid,a.lid,a.owner,b.id,'
. $qfields . ' FROM '.$this->std_table.' AS a, '
. $tmp_table .' AS b WHERE a.id=b.id ' . $filtertemp
. $squery . $ordermethod;