Re: Weird things happening with mysql
| From: | Ernest E Vogelsinger | Date: | Fri, 09 May 2003 15:31:15 +0000 |
| Subject: | Re: Weird things happening with mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147034@lists.php.net to get a copy of this message | ||
At 16:32 09.05.2003, Daniel R. Anderson said:
--------------------[snip]--------------------
>I have a $query for mysql that looks something like:
>
>$query = "SELECT * FROM table WHERE value = 'foo'";
>
>If I mysql_query with foo typed in it works like a charm. If however I
>try to:
>
>$query = "SELECT * FROM table WHERE value = '" . $_POST['foo'] .
>"'";
>$result = mysql_query($query);
>
>The query succeeds but returns an empty $result. (I know there is an
>entry in the table with foo (Primary Key).
>
>Anybody have any ideas why this might be?
--------------------[snip]--------------------
This should go into a php-general-faq, I think...
echo out your SELECT statement to see what it really tries to find. Check
any mysql error if there is one.
echo, and inspecting error returns, are the best debugger you can get.
And it's free ;-)
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/