On Tuesday 06 February 2001 18:18, April wrote:

> How do you pass an array as an argument to a function?

Just as any other variable. Read on...

> function process_members($asker_rank, $email) {
>
> global $database_mysql;
> mysql_select_db($database_mysql);
>
>     while (list ($key, $val) = each ($email)) {
>        echo "$key => $val<br>";
>     }
>
> }

> #########  Doing the same thing with the function here returns this
> error, though.  ########
> // Warning: Variable passed to each() is not an array or object in
> lib.inc on line 447
>  process_members($asker_rank, $total_members, $email);

Look at the definition of process_members() again. The function takes two 
values. The first is called $asker_rank and the second $email.
Now you pass *three* values to it. #1, $asker_rank, is fine. But #2, 
$total_members, is passed in place of $email, so every time the function 
body accedded its "$email" parameter, it gets the value of $total_members 
- which is not an array.
The third parameter is ignored.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Software is like sex: the best is for free" -- Linus Torvalds

--
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]

Reply via email to