You are here: Re: A simple IF condition. « PHP Programming Language « IT news, forums, messages
Re: A simple IF condition.

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация