Web Hosting Talk







View Full Version : Need Help On MYsql Query


saj
09-16-2006, 05:45 PM
Hi Everyone

im doing a Ramadhan TimeTable for this year to display on a Website

I Have 4 Fields

Day (0-30)
Date (0-31)
Sunrise (HH:MM)
Sunet (HH:MM)

What I want to do basically on the Website Display the following

Day : Date
Sunrise : Sunet

Displaying the times for sunrise and Sunset for 2day

and also have an extra for displaying times for sunrise and Sunset for 2moro

anyone know a query or how i would do this pleasE?

Thanks

horizon
09-17-2006, 12:55 AM
Sunrise:

http://www.w3schools.com/php/func_date_sunrise.asp

Sunset:

http://www.w3schools.com/php/func_date_sunset.asp

Burhan
09-17-2006, 01:52 AM
mysql> create table timings (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thedate DATE, sunrise TIME, sunset TIME);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into timings values ('',NOW(),NOW(),NOW());
Query OK, 1 row affected, 1 warning (0.04 sec)

mysql> select * from timings;
+----+------------+----------+----------+
| id | thedate | sunrise | sunset |
+----+------------+----------+----------+
| 1 | 2006-09-17 | 08:49:52 | 08:49:52 |
+----+------------+----------+----------+
1 row in set (0.00 sec)

mysql> select dayofmonth(thedate) as monthday, thedate, sunrise, sunset from timings;
+----------+------------+----------+----------+
| monthday | thedate | sunrise | sunset |
+----------+------------+----------+----------+
| 17 | 2006-09-17 | 08:49:52 | 08:49:52 |
+----------+------------+----------+----------+
1 row in set (0.00 sec)

mysql>


Hope that helps :)