Re: Populating an array from mysql db

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "mike karthauser" <mikek@brightstorm.co.uk>


> I have a course booking system that allows the client to add courses and
> then specify how long they run for. The admin system I have built allows
the
> client to add up to 30 dates for each instance of the course and these are
> adding to a database row in the form date1, date2, date3, daten etc.
>
> What I am trying to achieve now is to extract this data into an array so I
> can count how many dates have been added and to display the dates.
>
> If the course runs for eg. 2 days - values of date1 and date2 would be
> populated as date1=2003-09-01, date2=2003-09-02 - all other dates would be
> default to 0000-00-00 and I wish to ignore these.
>
> I'm trying to work out how to set up a loop to extract positive dates from
> my db so I end up with
>
> $bookdate[0] = '2003-09-01';
> $bookdate[1] = '2003-09-02'; etc
>
> Can anyone provide me with some help in this extraction?

With just a short comment on what a horrible, horrible database schema this
is, you should be able to use

if($date_from_db != '0000-00-00')
{ $bookdate[] = $date_from_db; }

---John Holmes...

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux