|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
MySQL not returning results
I've imported a CSV file into MySQL using the PHPMyAdmin web interface. The table holds customer account information (username, password, etc).
When I do a SELECT * FROM accounts, it returns all the results. When I SELECT * FROM accounts WHERE username LIKE *first half of a username* it will return results that match. But when I SELECT * FROM accounts WHERE username=*someones full username*, it will not return the information. Does anyone have any idea why? If I enter a record in by hand through PHPMyAdmin, I can do the username=*whatever* and it finds the correct user. Its only when I try to search a record that was imported from the CSV file. Thanks for any help. |
|
#2
|
|||
|
|||
|
Check that there aren't any extra characters or spaces that were inserted during your import. If you've got 'bob ' in your db, and you search for 'bob', you're going to come up empty. If you do have extra characters, you can use TRIM() to get rid of them.
__________________
"A pawn is the most important piece on the chessboard -- to a pawn" |
|
#3
|
|||
|
|||
|
Thanks for that advice. There are spaces at the end of every field. Is there a way to use TRIM when I'm importing the data? Even when I do my query with the space, it still doesn't return the result (ex: SELECT * FROM `accounts` WHERE `username`='johnt25090011 ').
What I'm doing is creating a website with PHP and MySQL so that the customers can log on. Whenever I try to log someone in though, it won't. I've tried putting their username/pass in with and without the space at the end and neither way lets me log in. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > MySQL not returning results |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|