Battle Zone
We think you should log in. Don't you?


This is the site for everything and anything you want to talk about. Want to discuss the latest games? Done. Want to have fun? Done. This is THE place to have a great time.
 
HomePortalFAQMemberlistRegisterLog in

Share | 
 

 hey rain need help

View previous topic View next topic Go down 
AuthorMessage
Night Angel
FRESH MEAT
avatar

Join date : 2010-03-10
Posts : 10


PostSubject: hey rain need help   Thu Apr 15, 2010 9:48 am

Code:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
   <head>
      <title>Array 10
      </title>
   </head>
   <body>
      <table border='1'>
         <?php
            $a=0;
            $y=range(1,10);
            while($a<=10){
               
                                      $z=rand(1,10);
                                     
                                      $a++;
            }
               shuffle($y);
                  foreach($y as $z){
                     echo "<tr><td>".$z."</td><td>".$y[$x]."</td></tr>";
                  }
         ?>
      </table>
   </body>
</html>

i am thinking about not echoing the $z variable in the while statement would it work
Back to top Go down
http://bbrhds21@gmail.com
Old Amsterdam
Bow Before Thy Master
Bow Before Thy Master
avatar

Join date : 2010-03-04
Rank : Head Admin / Site Owner

Posts : 7269


PostSubject: Re: hey rain need help   Thu Apr 15, 2010 9:58 am

You really messed it up, I think....You should get rid of that WHILE Loop, and before you echo anything in the FOREACH Loop, do your
Code:
$z=mt_rand(1,10);

Deleat the $a completely and then...
I'd make it look like
Code:

$y=range(1,10);
shuffle($y);
foreach ($y as $x){
$z=mt_rand(1,10);
echo "<tr><td>".$z."</td><td>".$x."</td></tr>";
}

See what that does. That should fix it.

_________________
As authors, it is our Duty
To create lovable, enticing Characters
And do horrible, evil things to Them.

Back to top Go down
http://battlezone.forumotion.net/
 

hey rain need help

View previous topic View next topic Back to top 

 Similar topics

-
» Jazwares MK & SF
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Battle Zone :: Extra! Extra! :: Random-
Jump to: