You are here: Re: Syntax for min and max « PHP Programming Language « IT news, forums, messages
Re: Syntax for min and max

Posted by lorento on 02/07/07 05:49

$ml_collect='SELECT MIN(ml_lopp.loppnum) as minNum, MAX
(ml_lopp.loppnum) as maxNum FROM ml_lopp LEFT JOIN scfmforening ON
(scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN ml_newtidplats ON
(ml_newtidplats.loppnum=ml_lopp.loppnum) ORDER BY date1,
ml_lopp.loppnum';

$ml_upg=mysql_query($ml_collect);

while ($row = mysql_fetch_object ($ml_upg))
{
$min = $row->minNum;
$max = $row->maxNum;
}
---
http://www.mastervb.net/phpbooks/
http://www.mastervb.net

On Feb 7, 7:59 am, "GarryJones" <mor...@algonet.se> wrote:
> I wish to assign a variable name to the MIN and MAX values of a field
> in a table. The type is int(7).
>
> I am extracting the field with many others with the following code
> from a php call.
>
> $ml_collect='SELECT * FROM ml_lopp LEFT JOIN scfmforening ON
> (scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN ml_newtidplats ON
> (ml_newtidplats.loppnum=ml_lopp.loppnum) ORDER BY date1,
> ml_lopp.loppnum';
>
> $ml_upg=mysql_query($ml_collect);
>
> mysql_close();
>
> The field is contained within the table ml_lopp and it is called
> loppnum
>
> I have been trying combinations of this to extract the min and max of
> the field from the $ml_upg variable which includes all of the data to
> be processed.
>
> $lownum=mysql_result($ml_upg,MIN('loppnum'));
> $hghnum=mysql_result($ml_upg,MAX('loppnum'));;
>
> Which does not work.
>
> I am very greafull of any help in this matter.
>
> Garry Jones
> Sweden

 

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

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