StefanRSA Posted November 23, 2009 Share Posted November 23, 2009 I have a while loop to get image names. $imagequery = mysql_query("SELECT * FROM ad_image WHERE user='$user' AND ad='$adnr' ORDER BY `picorder` ASC")or die(mysql_error()); $totpics = mysql_num_rows($imagequery); while ($imageset = mysql_fetch_array($imagequery)){ $order= $imageset['picorder']; $image= $imageset['image']; $title= $imageset['title']; $imagesize = getimagesize($modx->config['base_path'].'ad_images/'.$image); $height = $imagesize[1]; } How do I get the highest number of $height as $array = array($height); echo max($array); does not work? Link to comment https://forums.phpfreaks.com/topic/182642-max-problem/ Share on other sites More sharing options...
onlyican Posted November 23, 2009 Share Posted November 23, 2009 so Variable Array is being assigned to new array containing 1 value; This is being overwritten each time. You have 2 options in your loop if($height > $MaxHeight){ $MaxHeight = $Height; } Or your method $heightArr = array.push($height); Link to comment https://forums.phpfreaks.com/topic/182642-max-problem/#findComment-963952 Share on other sites More sharing options...
StefanRSA Posted November 23, 2009 Author Share Posted November 23, 2009 Thanks onlyican! Sometimes I wonder why I never got the solution myself!!! Again! Thanks..... Link to comment https://forums.phpfreaks.com/topic/182642-max-problem/#findComment-963966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.