Re: Array?
| From: | Craig Brothers | Date: | Wed, 25 Aug 2004 18:46:22 +0000 |
| Subject: | Re: Array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194713@lists.php.net to get a copy of this message | ||
how many elements are returned by the sql statement?
If you want the 7th item returned in the sql statement would need to
code $things[6]
Just a hunch...
--
Craig Brothers
@utoRevenue
cbrothers@autorevenue.com
(413) 528-8000 x105
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]);
>
>
> Thanks in advance,
> Nathan
> --
> Nathan Mealey
> Director of Operations
> Cycle-Smart, Inc.
> P.O. Box 1482
> Northampton, MA
> 01061-1482
> nathan@cycle-smart.com
> (413) 587-3133
> (413) 210-7984 Mobile
> (512) 681-7043 Fax