Re: Store array as Session Variable

From: Date: Mon, 28 Jul 2003 19:43:07 +0000
Subject: Re: Store array as Session Variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157229@lists.php.net to get a copy of this message
--- Pushpinder Singh Garcha <pgarcha@adelphia.net> wrote: > I am trying to store the value in row['company'] in an array > called $company_name. I see now. I think you might find this a bit simpler (if I understand correctly): $company_name = array(); while ($row = mysql_fetch_assoc($result)) { $company_name[] = $row['company']; } Also, at this point, you should probably examine the contents of $company_name before bothering with the session stuff. You may be having trouble with your query or something that is totally unrelated to sessions. Try John's suggestion of print_r() by doing something like this: echo '<pre>'; print_r($company_name); echo '</pre>'; Hope that helps. Chris ===== Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/

« previous php.general (#157229) next »