However, the sql query generated using this API generated an error:
Quote
...print_r($from);
Array ( [0] => etogal [1] => testtable1 [2] => testtable2 )...
« Execution of a query to the database failed »
SQL: SELECT * FROM `deagcr_etomite`.etomite_etogal, `deagcr_etomite`.etomite_testtable1, `deagcr_etomite`.etomite_testtable2 WHERE id=1 ORDER BY id ASC LIMIT 1;
Array ( [0] => etogal [1] => testtable1 [2] => testtable2 )...
« Execution of a query to the database failed »
SQL: SELECT * FROM `deagcr_etomite`.etomite_etogal, `deagcr_etomite`.etomite_testtable1, `deagcr_etomite`.etomite_testtable2 WHERE id=1 ORDER BY id ASC LIMIT 1;
After looking at the API code it looks as though this (above) is what is supposed to happen, (adding the table names in a string for each instance)...
// added multi-table abstraction capability
if(is_array($from)) {
$tbl = "";
foreach ($from as $_from) $tbl .= $this->db.$_from.", ";
$tbl = substr($tbl,0,-2);
} else {
$tbl = ($this->dbConfig['table_prefix'] != ''
&& strpos($from,$this->dbConfig['table_prefix']) === 0
|| !$addPrefix)
? $this->dbConfig['dbase'].".".$from
: $this->db.$from;
}
Handjamming the query into PHPMyAdmin used the following query:
Quote
SELECT `etomite_etogal`.*, `etomite_testtable1`.*, `etomite_testtable2`.*
FROM etomite_etogal, etomite_testtable1, etomite_testtable2
WHERE ((`etomite_etogal`.* id=1) AND (`etomite_testtable1`.* id=1) AND (`etomite_testtable2`.* id=1))
FROM etomite_etogal, etomite_testtable1, etomite_testtable2
WHERE ((`etomite_etogal`.* id=1) AND (`etomite_testtable1`.* id=1) AND (`etomite_testtable2`.* id=1))
As you can see, the SELECT fields="*", FROM , and WHERE clauses are appended to each table instance instead of a string of tables with a generic SQL query being applied to all .
I was wondering if anyone else had successfully used this API for multi-table selection, and if so, what am I doing wrong?












