Re: Array?
| From: | Robert Cummings | Date: | Wed, 25 Aug 2004 18:50:20 +0000 |
| Subject: | Re: Array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194715@lists.php.net to get a copy of this message | ||
On Wed, 2004-08-25 at 14:17, Nathan Mealey wrote:
> I cannot seem to access elements inside of the array $things in the
> code below. All of the errors say "Undefined offset: 7 in
> /Library/WebServer/Documents/lis/check.php on line 26" I don't see
> why...
>
> The code is:
>
> $q = "select * from users where email='".$email."' and
> password='".$pass."'";
> $results = mysql_query($q);
> if ($results) {
> while ($list=mysql_fetch_assoc($results)) {
> $things[]=$list;
> }
> }
> //$things[7] is a MySQL timestamp column named "last_login"
> $date = strtotime($things[7]);
You are fetching an association... use the following instead:
$date = strtotime($things['last_login']);
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'