Dropdown cause filter to break

QuestionsDropdown cause filter to break
Gary Brett asked 9 years ago

Hi Abu, I have many grids that utilise the dropdown menu when adding a record, these work great. However if I enable auto filter and search on one of the fields with a dropdown it throws a sql error which is confusing me?

For example in the filter field status when I type anything it outputs the below;

Couldn't execute query. Unknown column 'dbo_advisers.ContactFullName' in 'where clause' – SELECT count(*) as c FROM (Select c.client_id, c.Adviser, c.Client, c.DOB, c.Address1, c.Address2, c.Town, c.postcode, c.Phone, c.Email, c.Marketing, l.id, l.Status, l.StatusDate, l.CompDate, l.NPWDate, l.InvalidDate, l.Source, l.MortgageSize, l.MortgageType, l.PropertyValue, l.plan_type, l.provider, l.product, l.LeadDate, l.Cost, l.broker_fee From tbl_lead l Inner Join tbl_clients c On c.client_id = l.client_id WHERE 1=1 AND ( `dbo_advisers`.`ContactFullName` LIKE '%ka%' )) pg_tmp

I then cannot search on any field, just throws this. This happens on all fields with dropdown..

Pastebin http://pastebin.com/r62Epwzk

Thank you

2 Answers
Abu Ghufran answered 9 years ago

The table dbadvisor is not used in select_command. You cannot use it with dbname unless you make a inner join with that table too.

By looking at your code, it looks like it should be

$col["dbname"] = "c.Adviser";

Gary Brett answered 9 years ago

Brilliant, as usual fixed it for me!

Your Answer

17 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?