This topic is locked
[SOLVED]

 Search Filter Not Work

2/2/2013 1:48:24 PM
PHPRunner General questions
W
Windfall author

Please, I need your help. Tables containing relationships in my database are having problem in search field - listpage.

When i type some word and I search, always show me all records. Why filter not work?

S
swanside 2/3/2013



Please, I need your help. Tables containing relationships in my database are having problem in search field - listpage.

When i type some word and I search, always show me all records. Why filter not work?



At a guess I would say your relationships between tables is not correct.
Post a copy of your SQL syntax and what your searching for

Sergey Kornilov admin 2/4/2013

Try to enable SQL debugging to see the actual SQL query produces:

http://xlinesoft.com/phprunner/docs/debugging_tips.htm
This can point you in the right direction.

W
Windfall author 2/14/2013

Pardon my English ...
sorry, exhausted my attempts. I retired all relationships and i tried only with the WHERE clause but the problem still continues. As recommended me, i setting the DDEBUG parameter for true, see the result:
select GroupID from sistema colportor_ugmembers where UserName='teste@teste.com'

select TableName,AccessMask from sistema colportor_ugrights where GroupID in (-2)

select count(*) FROM clientes where clientes.Email_Colportor='teste@teste.com'

SELECT ID, Nome_Razao, Colportor_que_contactou, CPF, Inscricao_Estadual, Endereco, Bairro, Cidade, UF, Pais, Complemento, Telefone_fixo, Celular, CEP, Mapa, Observacoes, CNPJ, Data de Nascimento, Estado_Civil, Profissao, Filhos, Quantidade, Situacao, Data do Pagamento, Email, Condicao_Pagamento, Email_colportor FROM clientes where clientes.Email_Colportor='teste@teste.com' ORDER BY 1 ASC
The primary key is ID and on the List page: before SQL Query i have: $strWhereClause = "clientes.Email_Colportor='".$_SESSION['UserID']."'";
a 'colportor' can have multiple clients, however each 'colportor' can only see their own customers. The search does not work in this case.



Try to enable SQL debugging to see the actual SQL query produces:

http://xlinesoft.com/phprunner/docs/debugging_tips.htm
This can point you in the right direction.

Sergey Kornilov admin 2/14/2013

It's not really clear what is the question. I understand that your current SQL query is as follows:

SELECT ID, Nome_Razao, Colportor_que_contactou, CPF, Inscricao_Estadual, Endereco, Bairro, Cidade, UF, Pais, Complemento,

Telefone_fixo, Celular, CEP, Mapa, Observacoes, CNPJ, `Data de Nascimento`, Estado_Civil, Profissao, Filhos, Quantidade,

Situacao, `Data do Pagamento`, Email, Condicao_Pagamento, Email_colportor

FROM clientes where clientes.Email_Colportor='teste@teste.com' ORDER BY 1 ASC


How do you want to change this query?

W
Windfall author 2/17/2013

The problem is that when I type a name in the query, brings as result all records, always.

Sergey Kornilov admin 2/17/2013

Run this query manually against your database. Does it still brings all the records?

S
swanside 2/18/2013



Run this query manually against your database. Does it still brings all the records?


I had a similar problem when using ID's in my main jobs table.

I used cross table searching, so in my list page, I can see the Customer_Name that has been saved, but when I search, I am really looking at the customerId against the customerId in the customer table and displaying all jobs related to that customerId.

It works great.

It might help to export an SQl of the structure of your tables and post it so that we can take a better look.

SELECT

job.CustomerId,

job.CustomerId AS customerPK, //This is not enabled in the search page.

job.CustomerId AS Customer_Name, //This is not enabled in the search page.

job.CustomerEmail, //This is not enabled in the search page.

job.EngineerId,

job.EngineerId AS PDAAllocation, //This is not enabled in the search page.

job.EngineerId AS GasId, //This is not enabled in the search page.

job.LocationId,

job.LocationId AS locationPK, //This is not enabled in the search page.

job.LocationId AS Order_Site_Address, //This is not enabled in the search page.

job.JobTypeId,

job.JobTypeId AS JobSheet,

job.Exported,

job.Logged_By,

job.Logged_By AS ContactEmail,

job.PhoneNumber,

job.ResponseCatagories,

job.CallerName,

customer.Customer_Name AS CustomerName, //This is only enabled in the search page and now other pages

sites.site_address AS SiteAddress, //This is only enabled in the search page and now other pages

account.Engineer_Note AS Engineer //This is only enabled in the search page and now other pages

FROM job

INNER JOIN customer ON job.CustomerId = customer.CustomerId

INNER JOIN sites ON job.LocationId = sites.LocationId

INNER JOIN account ON job.EngineerId = account.EngineerId

ORDER BY job.Job_No DESC
W
Windfall author 2/18/2013

Does the fact that the field "Email_colportor" the Customers table is not the primary key it gives this error? Because when I insert on the list page: before sql query: $strWhereClause = ("clientes.email_colportor = '". $ _SESSION ['Userid']. "'") the filter search field no more not work.

W
Windfall author 2/27/2013

Thank you all for the help.

I found the problem. Was in access permissions to the tables.