Reply to Re: mysql_fetch for aggregate SQL function

Your name:

Reply:


Posted by bobkaku on 09/20/05 07:12

Steve,

Thanks so much. Your solution works like a charm!


Steve wrote:
> > $query = "select max(qno) from answers";
> > $result = mysql_query($query);
>
> > $maxqno = mysql_result($result);
>
> > $nextqno = $result + 1;
>
> mysql_result() needs a minimum of two arguments: resource and row
> number.
>
> Alternatively, use an alias for the aggregate column and get it by
> name:
>
> $query = "select max(qno) as maxqno from answers";
> $result = mysql_query( $query );
>
> $row = mysql_fetch_array( $result, MYSQL_ASSOC );
> print $row[ 'maxqno' ];
>
> ---
> Steve

[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

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