Results 1 to 9 of 9

Thread: trickly loop ? or me stupid ?

  1. #1

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609

    Exclamation trickly loop ? or me stupid ?

    i have a list of developers and their details, i have their details in arrays but i cant figure out some code to lopp through it all in a good way.

    here is that info i have:
    PHP Code:
    $developer1 = array('Name' => '****''Location' => 'Italy''Sourceforge' => '****''Work Areas' => 'PHP, MySQL, Perl');
    $developer2 = array('Name' => '****''Loation' => 'Australia''Sourceforge' => '****''Work Areas' => 'PHP, MySQL, Perl, Graphics');
    $developer3 = array('Name' => '****''Location' => 'The Netherlands''Sourceforge' => '****''Work Areas' => 'ASP, Graphics, client side(javascript)'); 
    note: hashes are for provacy reasons.

    how can i go through all the info easily ?

  2. #2
    scoutt
    Guest
    depends on how you want to display them.
    you could do something like this.
    PHP Code:
    $developer1 = array('Name' => '****''Location' => 'Italy''Sourceforge' => '****''Work Areas' => 'PHP, MySQL, Perl');
    $developer2 = array('Name' => '****''Loation' => 'Australia''Sourceforge' => '****''Work Areas' => 'PHP, MySQL, Perl, Graphics');
    $developer3 = array('Name' => '****''Location' => 'The Netherlands''Sourceforge' => '****''Work Areas' => 'ASP, Graphics, client side(javascript)');

    while(list(
    $key$value) = each ($developer1)){
          print 
    "value = ".$value."<br />";
      } 
    or you can do it like this

    PHP Code:
    $developer1 = array('Name' => '****''Location' => 'Italy''Sourceforge' => '****''Work Areas' => 'PHP, MySQL, Perl');
    $developer2 = array('Name' => '****''Loation' => 'Australia''Sourceforge' => '****''Work Areas' => 'PHP, MySQL, Perl, Graphics');
    $developer3 = array('Name' => '****''Location' => 'The Netherlands''Sourceforge' => '****''Work Areas' => 'ASP, Graphics, client side(javascript)');
    $all = array(=> $developer1=> $developer2=> $developer3);

    while(list(
    $key$value) = each ($all)){
          print 
    "value = ".$value."<br />";
      } 

  3. #3
    scoutt
    Guest
    actually this works
    PHP Code:
    <?
    echo" loop 1<br><br> ";

    $developer1 = array('Name' => '****', 'Location' => 'Italy', 'Sourceforge' => '****', 'Work Areas' => 'PHP, MySQL, Perl');
    $developer2 = array('Name' => '****', 'Location' => 'Australia', 'Sourceforge' => '****', 'Work Areas' => 'PHP, MySQL, Perl, Graphics');
    $developer3 = array('Name' => '****', 'Location' => 'The Netherlands', 'Sourceforge' => '****', 'Work Areas' => 'ASP, Graphics, client side(javascript)');

    while(list ($key, $val) = each($developer1)){
          print $key . " = ". $val ;
          print "<br />";
    }

    ?>

  4. #4

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    thanx scoutt, I'll give that a try

  5. #5

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    scoutt they give me this error: Parse error: parse error, unexpected T_STRING in c:\windows\desktop\files\wwwroot\virtue\advertising - page\pages\team.php on line 14 i dont think it likes me. do u know what this error could mean ? cos I'm assuming the code works on ur side perfectly.



    ?

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    what is on line 14?

  7. #7
    scoutt
    Guest
    which one did you use? the last one shouldn't produce any errors. like chris said, what is line 14 and what is your code.

  8. #8

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    code:

    PHP Code:
    <table width="100%" cellpadding="10" cellspacing="0">
        <tr>
        <td bgcolor="#B5B59C" background="gold_bg.gif">
        <?PHP
        
    // This is the start of the actual page contents


        
    $developer1 = array('Name' => 'Emanuele Sparvoli''Location' => 'Italy''Sourceforge' => 'godai78''Work Areas' => 'PHP, MySQL, Perl');
        
    $developer2 = array('Name' => 'Alan M. Cramer''Loation' => 'Australia''Sourceforge' => 'daqube''Work Areas' => 'PHP, MySQL, Perl, Graphics');
        
    $developer3 = array('Name' => 'Dave Smulders''Location' => 'The Netherlands''Sourceforge' => 'tss68nl''Work Areas' => 'ASP, Graphics, client side(javascript)');

    /*
            echo" loop 1<br><br> ";
            $developer1 = array('Name' => '****', 'Location' => 'Italy', 'Sourceforge' => '****', 'Work Areas' => 'PHP, MySQL, Perl');
            $developer2 = array('Name' => '****', 'Location' => 'Australia', 'Sourceforge' => '****', 'Work Areas' => 'PHP, MySQL, Perl, Graphics');
            $developer3 = array('Name' => '****', 'Location' => 'The Netherlands', 'Sourceforge' => '****', 'Work Areas' => 'ASP, Graphics, client side(javascript)');
            
            while(list ($key, $val) = each($developer1))
                    {
             print $key . " = ". $val ;
             print "<br />";
                    }
    */
    ?>
        
    </body>
    </html>

  9. #9
    scoutt
    Guest
    and this didn't work?

    PHP Code:
    <table width="100%" cellpadding="10" cellspacing="0">
        <tr>
        <td bgcolor="#B5B59C" background="gold_bg.gif">
        <?PHP
        
    // This is the start of the actual page contents


        
    $developer1 = array('Name' => 'Emanuele Sparvoli''Location' => 'Italy''Sourceforge' => 'godai78''Work Areas' => 'PHP, MySQL, Perl');
        
    $developer2 = array('Name' => 'Alan M. Cramer''Loation' => 'Australia''Sourceforge' => 'daqube''Work Areas' => 'PHP, MySQL, Perl, Graphics');
        
    $developer3 = array('Name' => 'Dave Smulders''Location' => 'The Netherlands''Sourceforge' => 'tss68nl''Work Areas' => 'ASP, Graphics, client side(javascript)');
                    
            while(list (
    $key$val) = each($developer1))
                    {
                  print 
    $key " = "$val ;
                  print 
    "<br />";
                    }

    ?>
        
    </body>
    </html>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width