--- Pushpinder Singh Garcha <[EMAIL PROTECTED]> wrote:
>   I am trying to store an array as a session variable.

Based on your code, it looked like your question had little to do with storing
an array as a session variable. To do that, this works:

$_SESSION['myarray'] = $myarray;

> while ($row = mysql_fetch_array($result))
> {
>      if (!is_array($company_name))
>           $company_name = array();                  
>      array_push($company_name, $row['company']);

I cleaned up your formatting a bit, so that we can read your code more easily.
Can you explain what you intend to do here?

It looks to me like you expect $company_name to be populated during the "$row =
mysql_fetch_array($result)" part, since you check whether it is an array during
every iteration of the loop. Then, you are erasing its value unless it is an
array. Is this right so far? Is this what you want to do? I think this bit of
code is likely where your problem lies.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to