Jump to content

Order by specific month


monkeybidz

Recommended Posts

Hello, all. Im new to this forum, and im stuck. Maybe someone here can help.
First of all, let me explain what i am trying to do.
I am try to have query result items starting by certian month. The current query i am using calls all months.
Here is the current query(sloppy):
[b][code]$query = "select a.id, a.title, u.nick, a.auction_type, a.buy_now, a.relist, a.starts, a.closed from PHPAUCTION_auctions a, PHPAUCTION_users u, PHPAUCTION_durations d where u.id=a.user and u.id='$id' and u.nick=u.nick and a.buy_now=a.buy_now and a.relist=a.relist and a.closed=a.closed and a.id=a.id and a.auction_type=a.auction_type order by a.starts ASC limit $offset, $limit";
[/code][/b]

a.starts table setting = varchar(14) default NULL

[b][code]$ID = mysql_result($result,$i,"id");
$title = stripslashes(mysql_result($result,$i,"title"));
$auction_type = mysql_result($result,$i,"a.auction_type");
$tmp_date = mysql_result($result,$i,"starts");
$duration = mysql_result($result,$i,"duration");
$auction_id = mysql_result($result,$i,"a.id");
$month = substr($tmp_date,4,2);
$day = substr($tmp_date,6,2);
$year = substr($tmp_date,0,4);
$date = "$month/$day/$year";
$buy_now = mysql_result($result,$i,"a.buy_now");
$closed = mysql_result($result,$i,"a.closed");
$relist = mysql_result($result,$i,"a.relist");
$nick = mysql_result($result,$i,"nick");
[/code][/b]

This month should be January
thanks in advance!
Link to comment
https://forums.phpfreaks.com/topic/4802-order-by-specific-month/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.