Jump to content

Can not figure out this DATE query


DBookatay

Recommended Posts


// Nav Tabs
   $query = "select DISTINCT YEAR(sold_date) FROM Sold";
   $result = mysql_query($query); 
   $numrows = mysql_num_rows($result); 
   while($row = mysql_fetch_array($result)){ 

      $year = substr($row['sold_date'], 0, -6);
      $navTab .= '<a class="miniTabOn" href="index.php?date='.$year.'">'.$year.'</a>';
   }

 

I am trying to create a link for each year of items in my database, yet the text is not showing up...

The "nav tab" is, because I can see the background image from the class="miniTabOn".

 

Can anyone spot an error?

Link to comment
https://forums.phpfreaks.com/topic/224910-can-not-figure-out-this-date-query/
Share on other sites

Search for 'alias' on this page - http://dev.mysql.com/doc/refman/5.1/en/select.html

 

When someone mentions a basic technical term related to programming that you don't understand, it is always best if you consult the original documentation that defines what was mentioned. You will get a more complete and concise explanation, often with examples, compared to just a portion of the information in a brief and quickly typed reply.

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.