MySQL result is 0 even though I can see it in the table -


Hi all I have found an interesting problem which I have never seen, but it appears that there is some crop here It is often so often, but no one is equal to my saturation.

I have a table that is the supplier data which is Imported from CCV

Then I match the product

However, I do not find a match in doing this, even though I can see the expected result in the table .

Here is my query:

  SELECT `Dealer`, WHERE from supplier_import_all` supplier_id` = '13' and` supplier_code` = 'DIGITAL 979' limitations 0 , 30  

and MySQL result message:

MySQL returned an empty result set (i.e. zero lines). (The query has taken 0.0027 seconds)

This is not correct, I can see the entry in the table in PHPMyAdmin:

Any ideas on this would really be appreciated because I'm stumped.


The following is added before entering the database and this problem is fixed:

  $ supplier_code = str_replace ('', '', $ supplier_code) ; $ Supplier_code = preg_replace ('/' [^ A-Za-z0-9 \ -] / ',' ', $ supplier_code); Still interested in knowing why the trim was not working, because I believe it should be white space anywhere around the data, which is reaffirmed by others. has been done.   

If you create your show table, then it will help.

It seems that you have data in bad or extra columns

select dealer, supplier_company_number from where the trim (supplier_id) = '13' and trim (supplier code) = 'DIGIT 9 9' range 0, 30

If this does not try, then this SELECT dealer, qty FROM supplier_import_all WHERE trim (supplier_id) = '13' LIMIT 0

And if that works

SELECT dealer, qty FROM supplier_import_all WHERE trim (SupplierDod) = 'DIGITAL 979' LIMIT 0, 30 < / Code>

This identifies you The column will contain bad data. Often when you import data from files, extra space / Chercator is added.

Edit as we now know this problem with the suplier_code column. Try to fix that data in that column. Update this supplier_import_all set supplier_code = trim (supplier_code);

Update supplier_import_all set supplier_code = trim (both "\ t" from supplier_code);

Update supplier_import_all set supplier_code = trim (both "\ n" from supplier_code); `


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -