blamu2 Posted May 12, 2011 Share Posted May 12, 2011 <?php $possibles[]; $alreadychosen[]; for ($i = 0; $i<20;$i++) $possibles =i+1; for (int $i = 0; $i<8; $i++) { $boolean= false; $randIndex=0; do { $randIndex = rand(1,20); for ($j = 0; $j< $i && !$hasInt; $j++) { if ($possibles[$randIndex] == $alreadyChosen[$j]) { $hasInt = true; } } } while ($hasInt); { $alreadyChosen = $possibles[randIndex]; echo($alreadyChosen); } for ($i = 0; $i<8;$i++) { if($alreadyChosen<10) { echo ('<a href="/mp/info130'+$i+'.htm"><img src="/mp/p130'+$i+'-1.jpg" height=180 width=120 align=left hspace=0 vspace=2 border=0 class=TopImages></a>'); } else if($alreadyChosen>10) { echo ('<a href="/mp/info13'+$i+'.htm"><img src="/mp/p13'+$i+'-1.jpg" height=180 width=120 align=left hspace=0 vspace=2 border=0 class=TopImages></a>'); it should select 8 images out of 20 but don't repeat please Quote Link to comment https://forums.phpfreaks.com/topic/236166-please-help-urgent/ Share on other sites More sharing options...
kenrbnsn Posted May 12, 2011 Share Posted May 12, 2011 First, when posting code on this forum, please put the code between tags. Next, Please describe your problem better. Ken Quote Link to comment https://forums.phpfreaks.com/topic/236166-please-help-urgent/#findComment-1214250 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.