Reply to Re: MySql count

Your name:

Reply:


Posted by Sanders Kaufman on 11/20/06 18:20

Akhenaten wrote:
> The following snippet (for whatever reason) returns no value for the
> count. Suggestions?
>
>
> $arr = array ("A", "B", "C", "D", "E");
> foreach ($arr as $client) {
> $count = mysql_query('SELECT COUNT(*) from table where columnA =
> $client');
> echo "$client has $count";
> echo '<br>';
> }

I see no single-quotes around $client in the SELECT
query.
That would make "$client" seem to be a field or
variable name, instead of a string value.

That probably means you're querying for where
columnA = the value of a variable named "$client"
instead of what you meant to query for which was
where columnA = the string in "$client".

I do that so much - it's one of the first errors I
check for anymore!

[Back to original 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

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