|
Posted by Alvaro G Vicario on 09/02/05 15:49
*** Alec wrote/escribió (2 Sep 2005 05:46:29 -0700):
> $check = @mysql_query ("SELECT townname FROM site01_towns WHERE
> townname='$townsearch'");
> if (!$check)
> {
> echo '<p>Cannot Find The Town</p>';
> exit();
>
> }
Let's check mysql_query() manual page:
"Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query() returns
a resource identifier or FALSE if the query was not executed correctly.
[...] A non-FALSE return value means that the query was legal and could be
executed by the server. It does not indicate anything about the number of
rows affected or returned. It is perfectly possible for a query to succeed
but affect no rows or return no rows."
Your if condition will only be FALSE if you have a syntax error in your SQL
query.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Navigation:
[Reply to this message]
|