Closed GoogleCodeExporter closed 9 years ago
Are you using version 2.0.2 from SVN trunk?
It seems that you are calling `db_select($column, $table, $condition)` instead
of `db_select($table, $column, $condition)` in functions.db.php.
Please verify, as this issue should not happen in the trunk version:
http://code.google.com/p/smt2/source/browse/trunk/admin/sys/functions.db.php
http://code.google.com/p/smt2/source/browse/trunk/admin/ext/tracking-report/anal
yze.php
Original comment by luis.lei...@gmail.com
on 20 Mar 2012 at 6:10
I am using 2.0.2 from SVN trunk. It appears that the problem is caused in
analyze.php and sql.php, in the sections that the sql query is constructed.
Apparently, associating an alias with multiple columns is causing the error:
=== Original code ===
$log = db_select($r." LEFT JOIN ".$c." ON ".$r.".cache_id = ".$c.".id LEFT JOIN
".$b." ON ".$r.".browser_id = ".$b.".id LEFT JOIN ".$o." ON ".$r.".os_id =
".$o.".id", $r.".* AS record, ".$c.".* AS cache, ".$b.".name AS browser,
".$o.".name AS os", TBL_PREFIX.TBL_RECORDS.".id = '".$id."'");
=====================
This one works..
=== Modified code ===
$log = db_select($r." LEFT JOIN ".$c." ON ".$r.".cache_id = ".$c.".id LEFT JOIN ".$b." ON ".$r.".browser_id = ".$b.".id LEFT JOIN ".$o." ON ".$r.".os_id = ".$o.".id", $r.".*, ".$c.".*, ".$b.".name AS browser, ".$o.".name AS os", TBL_PREFIX.TBL_RECORDS.".id = '".$id."'");
=====================
Original comment by arapakis...@gmail.com
on 20 Mar 2012 at 7:22
The alias is used in each left join for convenience, to avoid collisions when
various columns in various tables have the same name (e.g. all joined tables
have an "id" column). However, in analyze.php $log['id'] is not needed, so
there is no risk of collision and in effect you can safely remove the aliases.
I don't remember if there are other scripts that access the id column from
other tables in the same SQL query, so right now I cannot remove those aliases
from the code. BTW, you are the first one in reporting that issue.
I'll leave this issue open until the next version 2.1.0 is released.
Original comment by luis.lei...@gmail.com
on 21 Mar 2012 at 9:14
Eventually alias were removed, since they are no longer needed in other scripts.
Therefore I'm closing this issue, as it is solved in current version (2.1.0).
Original comment by luis.lei...@gmail.com
on 31 Mar 2012 at 6:21
Original issue reported on code.google.com by
arapakis...@gmail.com
on 20 Mar 2012 at 5:02