|
-
May 7th, 2002, 09:25 PM
#1
Thread Starter
Fanatic Member
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 ?
-
May 8th, 2002, 09:31 AM
#2
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(0 => $developer1, 1 => $developer2, 2 => $developer3);
while(list($key, $value) = each ($all)){
print "value = ".$value."<br />";
}
-
May 8th, 2002, 10:40 AM
#3
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 />";
}
?>
-
May 8th, 2002, 08:15 PM
#4
Thread Starter
Fanatic Member
thanx scoutt, I'll give that a try
-
May 11th, 2002, 08:18 AM
#5
Thread Starter
Fanatic Member
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.
?
-
May 11th, 2002, 10:00 AM
#6
PowerPoster
-
May 11th, 2002, 01:20 PM
#7
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.
-
May 11th, 2002, 09:49 PM
#8
Thread Starter
Fanatic Member
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>
-
May 11th, 2002, 09:54 PM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|