Re: MySQL Data Not Returned
| From: | Neil Smith [MVP, Digital media] | Date: | Sat, 13 Nov 2004 15:11:48 +0000 |
| Subject: | Re: MySQL Data Not Returned | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37256@lists.php.net to get a copy of this message | ||
My guess (and it will be correct) is that you've got a not visible character on the end of your email address in the database. Such a character could be a space, newline, tab or other similar character.
Make sure you use trim($email_address) to create the field to insert into the database !
Check the actual string you get returned from the query on the DB with the query
SELECT * FROM mailinglist WHERE email like '$email%'
Use strlen($resul["email"]); and you'll see that the length of the email address is not the same as the number of characters in the email address if you count them manually.
Cheers - Neil
At 11:54 13/11/2004 +0000, you wrote:
I search the list like so: $email="someone@someone.com"; $query=mysqli_query($cnn,"SELECT * FROM mailinglist WHERE email='$email'"); When I do: Echo mysqli_num_rows($query); I get 0 back, The address I am searching is in the database, I have triple checked it with phpmyadmin. The only way I can get it to return the record I am looking for is to do this. $email="someone@someone.com"; $query=mysqli_query($cnn,"SELECT * FROM mailinglist WHERE email like '$email%'"); Then this finally returns 1. I have tried many different email addresses; nothing comes back, not even from the SQL query window within phpmyadmin v. 2.6.0-rc2 This has been puzzling me for hours on end. If anyone can provide any help, that would be great