I'd worry about the empty dates after. and use something like.

$qry = "select date1, date2 from table";
$result = mysql_query($qry) or die(mysql_error());
while ($rs = mysql_fetch_row($result)) {
//this array could be built a number of ways, one is
      $bookdate[] = array($rs[0],$rs[1]);

if i've not misunderstood, that should work

                      mike karthauser                                                  
                      <[EMAIL PROTECTED]        To:       <[EMAIL PROTECTED]>          
                      m.co.uk>                 cc:                                     
                                               Subject:  [PHP-DB] Populating an array 
from mysql db                                     
                      08/28/2003 08:01                                                 

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
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?

Thanks in advance.

Mike Karthauser
Managing Director - Brightstorm Ltd

Email       >> [EMAIL PROTECTED]
Web         >> http://www.brightstorm.co.uk
Tel         >> 0117 9426653 (office)
               07939 252144 (mobile)

Snailmail   >> Unit 8, 14 King Square,
               Bristol BS2 8JJ

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

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

Reply via email to