473,508 Members | 4,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

arrays, queries, birthdays, ...

hi all,

I have this problem that I cant solve.

I have created an agenda (http://28edegem.scoutnet.be/agenda.php) . The
agenda contains events and birthdays of the members. I query the events and
birthdays per month and sort them on date.
This method works fine for the events since they are all for the same year
(eg 2003) but doesnt work for the birthdays because someone born in
1980-06-23 will be sorted before someone born in 1876-06-05 . This is a big
problem because the person born on the fifth day wont be echo'ed . The
problem can be easily be solved by only requesting the month and day part of
the birthday. I'm not sure this is possible?

If the above doesnt seem to work I can always order the array myself. How
can I access a query array? I guess I can't use the fetch_row ?

kind regards
Stijn
Jul 16 '05 #1
2 2434
Stijn Goris wrote:
[...]
The
problem can be easily be solved by only requesting the month and day part of
the birthday. I'm not sure this is possible?

If the above doesnt seem to work I can always order the array myself. How
can I access a query array? I guess I can't use the fetch_row ?


Better to do it at the database side (for MySQL):

$sql = "select month(birthdate), dayofmonth(birthdate), name, address"
." from agenda"
." where public=1"
." order by 1, 2";

--
"Yes, I'm positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:
Jul 16 '05 #2
Stijn Goris wrote:
hi all,

I have this problem that I cant solve.

I have created an agenda (http://28edegem.scoutnet.be/agenda.php) . The
agenda contains events and birthdays of the members. I query the events and
birthdays per month and sort them on date.
This method works fine for the events since they are all for the same year
(eg 2003) but doesnt work for the birthdays because someone born in
1980-06-23 will be sorted before someone born in 1876-06-05 . This is a big
problem because the person born on the fifth day wont be echo'ed . The
problem can be easily be solved by only requesting the month and day part of
the birthday. I'm not sure this is possible?

If the above doesnt seem to work I can always order the array myself. How
can I access a query array? I guess I can't use the fetch_row ?

order by dayofmonth(date)

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
3599
by: Troll | last post by:
Hi, I need to write a script which reads some data and reports the findings. Just to give you an idea the structure is similar to the following. Data input example: HEADING 1 **********...
17
2679
by: middletree | last post by:
OK, you pros out there are rolling your eyes at the subject line, but I have never had to use arrays before. The scenario: ASP Intranet app keeps track of trouble tickets for a tech support group....
3
3773
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes...
5
3033
by: Michal Táborský | last post by:
I am wondering, if it's effective to use text arrays to store multilanguage information. We used to do it like this: CREATE TABLE product ( id serial NOT NULL, price float4, ... )
1
2045
by: ferraro.joseph | last post by:
Hi, I'm querying Salesforce.com via their AJAX toolkit and outputting query results into a table. Currently, their toolkit does not possess the ability to do table joins via their structured...
8
1598
by: mantrid | last post by:
Hello Im having problems working out why the following code does not work. I dont think its the sql as the error occurs on the first update which ever one is put there ($q1 or $q2). Ive swapped...
15
449
by: TKirahvi | last post by:
Why can't I create Objects in an Array within for/while loop? If I have: Code: $galleries = array(); while( $db->next_record() ) {
1
1924
by: rpjd | last post by:
I am completely new to this so please bear with me here. My project involves a webpage executing php scripts via an xmlhttprequest which queries a database and returns data to the webpage. This code...
6
7570
by: onlyshanks28 | last post by:
Hi I have a database birthday containing name and DOB, I want to find the query which can display 3 latest birth day. I tried select name,date from birthday where...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.