Jump to content

[SOLVED] mysql error


alin19

Recommended Posts

i have this code, but i recive $max as my las record in that table, i must go and edit the last record and save it to get the real $max

 

can you help me?

 

 

$query="SELECT * FROM `$operator` LIMIT 0 , 30";

 

 

if ($r=mysql_query($query))

{

while ($row = mysql_fetch_array($r))

{

//$cupoane[]=$row['nr.cupoane'];

$zile[]=$row['zi'];

$cupoane[]=$row['nr.cupoane'];

echo " ";

 

}

}

 

$inrCupoane=count ($cupoane);

$inreZi=count ($zile);

$min=999;

$max=0;

 

for ($v=0;$v<$inreZi;$v++)

{

if ($max<$cupoane[$v])

$max=$cupoane[$v];

 

if($min>$cupoane[$v])

$min=$cupoane[$v];

}

Link to comment
https://forums.phpfreaks.com/topic/89882-solved-mysql-error/
Share on other sites

i HATE to say it, but i think you're being a bit of a numpty here.

I'm guessing (by looking at what you're doing) but i'd say you're looking for the MAX and MIN for nr.cupoane.

You can do this using the SQL query and NOT php...

 

SELECT MAX(nr.cupoane), MIN(nr.cupoane) FROM `$operator`;

Link to comment
https://forums.phpfreaks.com/topic/89882-solved-mysql-error/#findComment-460635
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.