[PHP-DB] More Date operations.

2002-01-31 Thread Garry Optland
Hi, I am trying to access the MySQL function TO_DAYS() from PHP. From MySQL I can type in: SELECT TO_DAYS('2000-1-1') AS bar; and I get: ++ | bar| ++ | 730485 | ++ 1 row in set (0.00 sec) From PHP, I have tried: $sql=SELECT TO_DAYS(2001-01-01) AS bar;

Re: [PHP-DB] Date operations.

2002-01-29 Thread Garry Optland
On Wed, 30 Jan 2002, DL Neil wrote: Can I request some db-speak please? You already have a tbl (or more). So let's start by asking for the table definitions The table definition is as follows: CREATE TABLE breeding ( rec SMALLINT(4) UNSIGNED AUTO_INCREMENT, sire SMALLINT(4) UNSIGNED,

Re: [PHP-DB] Date operations.

2002-01-29 Thread Garry Optland
On Thu, 31 Jan 2002, DL Neil wrote: Garry, I regret to say that I can't see an immediate answer. CREATE TABLE breeding ( rec SMALLINT(4) UNSIGNED AUTO_INCREMENT, sire SMALLINT(4) UNSIGNED, dam SMALLINT(4) UNSIGNED, paired DATE, split DATE, num_offspring TINYINT(1)

[PHP-DB] Date operations.

2002-01-28 Thread Garry Optland
Hi All, I have a problem working out a suitable algorithm either in PHP or MySQL. Basically I have a DB that keeps track of breeding records. Each record has a paired data, and a split-up date. I need to generate some statistics to work out average numbers of pairs per month, averaged on a