R u sure your printing out the correct array (hash) field? Did you connect
to the db? Is mysql_error reporting an error?
DVP
Dathan Vance Pattishall http://www.friendster.com
-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of T. H. Grejc
Sent: Sunday, May
From: T. H. Grejc
Hello,
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me an empty array. What am I doing wrong?
TNX
I think you need this
At 22:27 +0200 5/16/04, John Fawcett wrote:
From: T. H. Grejc
Hello,
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me an empty array. What am I doing wrong?
John Fawcett wrote:
From: T. H. Grejc
Hello,
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me an empty array. What am I doing wrong?
TNX
I think you need this
Paul DuBois wrote:
At 22:27 +0200 5/16/04, John Fawcett wrote:
From: T. H. Grejc
Hello,
I'm trying to select all distinct years from a unixtimestamp field in
MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me an empty array. What
From: T. H. Grejc
How can I add more fields to query. If I write:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M'), other_field FROM
table_name ORDER BY created DESC
I loose distinction (all dates are displayed).
TNX
I don't think distinction is lost. All the rows should still be distinct
From: Paul DuBois At 22:27 +0200 5/16/04,
John Fawcett wrote:
Year does not operate on a unix timestamp.
Sure it does:
mysql select t, year(t) from tsdemo1;
++-+
| t | year(t) |
++-+
| 20010822133241 |2001 |
|
John Fawcett wrote:
From: T. H. Grejc
How can I add more fields to query. If I write:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M'), other_field FROM
table_name ORDER BY created DESC
I loose distinction (all dates are displayed).
TNX
I don't think distinction is lost. All the rows should still
At 0:25 +0200 5/17/04, John Fawcett wrote:
From: Paul DuBois At 22:27 +0200 5/16/04,
John Fawcett wrote:
Year does not operate on a unix timestamp.
Sure it does:
mysql select t, year(t) from tsdemo1;
++-+
| t | year(t) |
++-+
|
From: T. H. Grejc
I'm creating news archive and it should be sorted by months:
January 2004 (news count is 56)
February 2004 (48)
...
So you need to use GROUP BY and COUNT.
The format is like this:
select monthandyear,count(othercolumn) from t
group by monthandyear
in your case
10 matches
Mail list logo