Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erorr in events page #417

Open
Si-HaMaDa opened this issue Jan 19, 2019 · 12 comments
Open

Erorr in events page #417

Si-HaMaDa opened this issue Jan 19, 2019 · 12 comments
Assignees

Comments

@Si-HaMaDa
Copy link

Si-HaMaDa commented Jan 19, 2019

I installed the pakage and worked fine but when trying to open events page in stats it's giving me error
pop up error:
DataTables warning: table id=table_div - Ajax error. For more information about this error, please see http://datatables.net/tn/7
and when trying to see the requests
here's the Request URL
http://localhost/.../public/stats/api/events?draw=1&columns[0][data]=name&columns[0][name]=&columns[0][searchable]=false&columns[0][orderable]=true&columns[0][search][value]=&columns[0][search][regex]=false&columns[1][data]=total&columns[1][name]=&columns[1][searchable]=false&columns[1][orderable]=true&columns[1][search][value]=&columns[1][search][regex]=false&order[0][column]=0&order[0][dir]=asc&start=0&length=10&search[value]=&search[regex]=false&_=1547915504921

and here's the response

message | SQLSTATE[HY000]: General error: 1 ambiguous column name: id (SQL: select "tracker_events"."id", "tracker_events"."name", count(tracker_events_log.id) as total from "tracker_events" inner join "tracker_events_log" on "tracker_events_log"."event_id" = "tracker_events"."id" where "tracker_events_log"."updated_at" >= 2019-01-18 16:31:47 and "tracker_events_log"."updated_at" <= 2019-01-19 16:31:47 group by "tracker_events"."id", "tracker_events"."name" order by "total" desc, "id" asc limit 10 offset 0)
exception | Illuminate\Database\QueryException

@napestershine
Copy link
Collaborator

@Si-HaMaDa can you please try now, after doing composer update ?

@Si-HaMaDa
Copy link
Author

Si-HaMaDa commented Jan 27, 2019

@napestershine
for sorry still the same error
and for record I'm working with sqlite

@napestershine
Copy link
Collaborator

@Si-HaMaDa if possible can you attach a screenshot, I remember I fixed it last weekend And can't get same error on my system .

@Si-HaMaDa
Copy link
Author

@napestershine
Sorry for late but still the same problem in events page...
But this update fixed another problem which to fix I commented this
parent::__construct($attributes);
on line 16 in the construct in Base.php
now it's working fine without commenting this line

@antonioribeiro
Copy link
Owner

antonioribeiro commented Feb 1, 2019

@Si-HaMaDa, Just tagged version 3.3.2, would you please update and try again?

@Si-HaMaDa
Copy link
Author

@antonioribeiro
the same...
are you sure it's fixed?!
maybe I've something wrong!

@napestershine
Copy link
Collaborator

@Si-HaMaDa do you get same error message or it's different ?

@Si-HaMaDa
Copy link
Author

@napestershine
the same error
SQLSTATE[HY000]: General error: 1 ambiguous column name: id (SQL: select "tracker_events"."id", "tracker_events"."name", count(tracker_events_log.id) as total from "tracker_events" inner join "tracker_events_log" on "tracker_events_log"."event_id" = "tracker_events"."id" where "tracker_events_log"."updated_at" >= 2019-01-31 21:26:46 and "tracker_events_log"."updated_at" <= 2019-02-01 21:26:46 group by "tracker_events"."id", "tracker_events"."name" order by "total" desc, "id" asc limit 10 offset 0)

@napestershine
Copy link
Collaborator

@Si-HaMaDa I am on it. I got it. I will push update in sometime.

@napestershine
Copy link
Collaborator

napestershine commented Feb 2, 2019

@Si-HaMaDa I have same system running, and same query is running on my system perfectly. Can you share system environment?

If I am not wrong we have same query:
image

@Si-HaMaDa
Copy link
Author

@napestershine
I just tried to work with MySql and there's no error :D
so this error only happening with SqLite, I've tried on local and server and the error is the same when using SqLite
I mentioned in the first comment that I use SqLite, don't know if you see and try that or not :D

@RaymondSalim
Copy link

I know this is a pretty old thread, came across this too. Same as @Si-HaMaDa, I only got this error when using Sqlite.

I traced the error and it ends up being inside Datatables.php

// vendor/pragmarx/datatables/src/Bllim/Datatables/Datatables.php

.....

protected function ordering()
    {
        if (array_key_exists('order', $this->input) && count($this->input['order']) > 0) {
-            $columns = $this->cleanColumns($this->aliased_ordered_columns);
//            The "ambiguous column name" error is because $columns contains only the column name, while we need the table name
+            $columns = $this->aliased_ordered_columns;
            for ($i = 0, $c = count($this->input['order']); $i < $c; $i++) {
                $order_col = (int)$this->input['order'][$i]['column'];
                if (isset($columns[$order_col])) {
                    if ($this->input['columns'][$order_col]['orderable'] == "true") {
                        $this->query->orderBy($columns[$order_col], $this->input['order'][$i]['dir']);
                    }
                }
            }

        }
    }

....

After changing that it works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants