Jump to content

Dynamically execute an exec() based on number of results in an array.


CBR

Recommended Posts

I have an array that has 1-100 values depending on the amount of results that are selected in a multiple form box which then created an array. I am able to display each array by echoing $array[0]-[whatever]. What I have done is then counted the array for the number of results using the following code.

 

$tcount = count($toBox3);
echo "$tcount";

 

Simple enough there but now I am stumped.

 

I need for each array, run an exec command but I need it to stop at the end of the last array. It need to be dynamically done so if they select 10 results, or 100 results it builds the code needed and executes that number of time and also counts 1-whatever. So is there a way of doing this?

 

Hope this makes sense. I will include an example of what I am attempting but with an echo statement.

 

if ( $toBox[0] != "" )
  { 

    echo "$array[0]<br>";

  }

elseif ( $array[1] != "" )
  { 

    echo "$array[1]<br>";

  }

elseif ( $array[2] != "" )
  { 

    echo "$array[2]<br>";

  }

 

Thanks in advance for any help.

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.