Jump to content

[SOLVED] outputting sql rows by a specific column?


des1017

Recommended Posts

I've tried to find some information on this, but didn't have any luck.

I've got roughly 7 columns in one of my tables (date being one of them ie 20080725)

 

I want to display a while statement for instance like this:

 

				$queryx  = "SELECT * FROM $tableunits";
			$resultx = mysql_query($queryx);
			$counter = 1;
			while($row = mysql_fetch_array($resultx, MYSQL_BOTH))
			{

			if($counter <= 10) {
			echo "<div id='nitem'>
			<a href='jewelry.php?item=".$row["unitid"]."'><img src='jewelry/".$row["unitimage"]."' alt='".$row["unitname"]."' width='100' height='100'><br />-> Click Here</a>
			</div>";
			}

			$counter = $counter + 1;

			}

 

except I want to display the first 10 sorted by the most recent date added, which happens to be the date column in my table.

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.