Re: Populating an array from mysql db
| From: | mike karthauser | Date: | Thu, 28 Aug 2003 16:24:35 +0000 |
| Subject: | Re: Populating an array from mysql db | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30190@lists.php.net to get a copy of this message | ||
on 28/8/03 5:00 pm, CPT John W. Holmes at holmes072000@charter.net wrote:
>> Thanks for this - I ended up rehashing my query to this:
>>
>> <?
>> $result = mysql_query("SELECT * FROM dates WHERE bookcode = '$bookcode'
>> ORDER BY date1",$db);
>>
>>
>> // loop to populate array
>>
>> $myrow = mysql_fetch_array($result);
>>
>> $i = 1;
>> while ($i <= '30') {
>>
>> if ($myrow['date'.$i] > '0000-00-00')
>
> You're making PHP do some extra work here. You're testing to see if one
> string is greater than another... how can strings be greater than or less
> than? Why don't you just check for $myrow['date'.$i] != '0000-00-00'
> ??
Thanks. I'll make your change.
Ta.
--
Mike Karthauser
Managing Director - Brightstorm Ltd
Email >> mikek@brightstorm.co.uk
Web >> http://www.brightstorm.co.uk
Tel >> 0117 9426653 (office)
07939 252144 (mobile)
Snailmail >> Unit 8, 14 King Square,
Bristol BS2 8JJ