Help with Grid View

Ive got this issue bugging me for along time now. Basically i want a grid view to display data that is ordered by date and time. Exactly like many TV guides out there. Here is my code at the moment.

[php]

$return .= “

”;
$channel= mysql_query(“SELECT * FROM channel LIMIT 1”);
  while($channel_rows = mysql_fetch_array($channel)){
		$cid = $channel_rows['pkVenueID'];
		$cname = $channel_rows['fldName'];
		
		$shows =  mysql_query("SELECT * FROM `tblEvent` WHERE cid=  '".$cid."' ORDER BY fldOpen ASC");
		
                    $return .= "<tr>";

$return .= “

";
$return.= “
”.$cname."”;
while($show= mysql_fetch_array($shows)){
$cid = $event[‘fkVenueID’];
$title = $event[‘fldTitle’];
			$start = $event['start']; 
  			        $stop = $event['stop']; 
			


		$return.= "<div><h3>".$title."</h3></div>";
	}

	
		$return.= "</td></tr>";

$return .= “

”;

[/php]

Well, the EASY way is to just load the info from the database sorted for you. You basically just add the ORDER option to your query.

Something like “SELECT blah blah blah WHERE blah blah blah ORDERED by data, time”…

This should work for you nicely. I am sure you have the data and time in your database to sort by. Since the query runs server-side it will be a fast sort for you and does the heavy lifting for you… LOL

Good luck, let us know if you have any questions…

Sponsor our Newsletter | Privacy Policy | Terms of Service