Hi all, ive got a big question about conducting mysql_queries.. i have a schedule program that needs to sort through and pick the records that apply.. the date will change, and used a php date() formatted to mysql date and pick out the ones records that are active vers inactive. and finally sort through the other fields..

$sql="SELECT * FROM $dbtable WHERE date = $sysdate AND recstatus='active' ORDER BY ftime ASC, stime ASC, tailnum ASC";

can anyone tell me if im on the right track or am i going the wrong direction? THX to anyone that can help!!

Recommended Answers

All 3 Replies

It generally seems OK but I couldn't say without seeing the table structure you are querying against. For example, what is the difference between column date and column ftime? Are you storing date and time into two seperate columns?

Also, if $sysdate is meant to be today's date, you can use a MySQL function, CURDATE() aka CURRENT_DATE() to get that (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html)

in php config file:

$sysdate=date('Y/m/d');

in the table

recstatus varchar(50) < to determine if i should show the record Actice(yes) or skip it inactive(no)
date = date < used to hold the date format YYYY/MM/DD
ftime = time < used for start time format HH:MM:SS
stime = time < used for end time format HH:MM:SS

im trying to compare what the record has against what i want to show in realtime date and sort by ftime and stime

also for current date, trying to keep it configured using:

date_default_timezone_set("America/Phoenix");

due to server being on east coast time. thought would be easier for me then using mysql function

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.