query sql does not work

0

My system is generating a query from a filter. All the query that I use in a given field can find nothing, both simple and query .

select * from prt_license WHERE organization_type = 'commercial';
//testei na ide de banco de dados e da retorno vazio

As for what the system generates, which are querys similar to the below:

select sql_calc_found_rows id_license, organization_name
       , organization_type, edition, licensed_version
       , updates_expiry_date, support_expiry_date, issued_date
       , users_licensed, advanced_clients_licensed, razao_social
from  license_report_view
where ativo = 1 
      and organization_type in ('commercial' , 'professional') 
      and users_licensed between 5 and 1000
order by id_license asc limit 0, 10

I have already entered a small and upper case, but nothing works. The field is varchar of 100.

I have no idea why it is not working, since there is another table that also used the same technique that worked perfectly.

Result

Resultwithsecondquery

    
asked by anonymous 25.04.2017 / 19:09

2 answers

1

Your problem is not in the select of your bank but in the way you are reading your txt file. Use the trim($arquivo) function of php to clear the whitespace.

Due to white space storage, your select can not find any results, so for testing you can always use the length sql command to check the size of your varchar .

    
25.04.2017 / 21:03
1

I do not know what your bank might be for commands, but follow the example below:

select * from prt_license WHERE TRIM(UPPER(organization_type)) = TRIM(UPPER('commercial'));
    
25.04.2017 / 19:33