Jump to content

[SOLVED] Auto selecting script


EchoFool

Recommended Posts

Hey,

 

Looking for some ideas on what is best way to approach an idea i have.

 

I have for 4 variables calculated from values in fields related to record id's there are 4 record id's in total.

 

So while it while loops these 4 rows it generates the four values like this:

 

Record 1 = 1000
Record 2 = 2000
Record 3 = 500
Record 4 = 100

 

Now this is worked out by grabbing field values then using php to calculate total value. What I am trying to do whilst it is while looping though is select the lowest value record.

 

In the above case it would be record 4 but I am not sure what kinda php feature to use to do this ? Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/133923-solved-auto-selecting-script/
Share on other sites

Hey i have put that in like this this but it isn't working:

 

 

<?php
print_r($State); Echo '<br>';
echo min($State);    
?>

 

Which displays:

Array ( [1] => 178061500 [2] => 0 [3] => 0 [4] => 0 )

0

 

Was hoping it would show value [2] because thats the lowest value and then to sort it out from a tie between 3 and 4 its the lowest position in the array but it just returns 0 =/

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.