Re: Populating an array from mysql db

From: Date: Thu, 28 Aug 2003 12:47:41 +0000
Subject: Re: Populating an array from mysql db
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-30181@lists.php.net to get a copy of this message
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...

« previous php.db (#30181) next »