[PHP] Re: Array's

2001-10-28 Thread _lallous

 $b=array($surname,$init),  // does it work
like
it does work like that, but you're creating an array of one item which is a
string holding to values comma seperated.
you can do this too:
 $b=array($surname,$init),  // does it work like
w/o the quotes.
and also no need to put quotes around the $b or $a.
and when you're storing one element no need to put it in an array like you
did for this:
 = array($a=array($co_id),
do directly:
array($a = $co_id, ...

 I have 4 fields that i want to to put in an array and about 3000 records.
 How can i list the fields in an array and retrive the values out of the
 array

$values = array();
$i =0;
while (getting the rows)
{
  list($id, $surname, $ba) = $row;
  $values[$i]['surname'] = $surname;
  $values[$i]['id'] = $id;
  $values[$i]['ba'] = $ba;
  $i++;
}

retrieve any element as:
$values[INDEX HERE]['surname'] for example.


De Necker Henri [EMAIL PROTECTED] wrote in message
3A8ED7A62794D311AA7700508B6164EC08DCA35E@SCPTS01">news:3A8ED7A62794D311AA7700508B6164EC08DCA35E@SCPTS01...
 Please help!

 Im have been trying to get a multi-dimentional array for so time now and
 dont seems to get a right!

 I have the following :

 while($row=db_range()){
   list($co_id,$surname,$init,$ba) = $row;

   $acid[$i] = array($a=array($co_id),
 $b=array($surname,$init),  // does it work
like
 this ???
 $c=array($ba)) ;

   $i++;
 }//end while 1

 I have 4 fields that i want to to put in an array and about 3000 records.
 How can i list the fields in an array and retrive the values out of the
 array

 PLS help!





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: Array's in classes

2001-08-24 Thread Tim Ward

Can't help too much without more code, but the diagnostics I'd use would be
foreach() and count() to find out what is there rather than seeing if what I
expect to be there actually is.

Tim Ward

--
From:  Scott Mebberson [SMTP:[EMAIL PROTECTED]]
Sent:  24 August 2001 00:52
To:  [EMAIL PROTECTED]
Subject:  Array's in classes

Hi Guys,

I have written a class in which it uses the global command to get
the value
of a variable from outside of this class which I use within the
class.

I have recently changed this variable to an array and added 5 extra
keys to
this array. It is a string indexed array. In now seems as though PHP
wont
import the array. It is really weird though because if I access the
key of
an array such as $database[hostname] is just echo's nothing at all
to the
browser. It also echo's nothing to the browser if I use
$database[0]. But,
if I echo just $database to the browser it returns Array ?

Does anybody have any idea of why this is happening?

Thanks

Scott.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]