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
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 =/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.