Tuesday, March 4, 2014

Tute 26 : Latest Data show in category page : Part One

Last tutorial we show latest data in home page in our side. But this is show only home page. Now we show this latest data in category page. We will show this dynamically.


We create a div in right panel same of index.php file. We write this code :

-----------------------------------------
<div class="latest-news">
<h2>Latest of This Category<h2>
</div>
------------------------------------------

Make  a new query for latest news. We write query code after " $query_cat_run=mysql_query($query_cat); " line :

--------------------------------------------------------------------------------------------------------
$query_lat= "SELECT `id`, `heading` FROM tute WHERE category='".$n_category."' ORDER BY id DESC";
$query_lat_run=mysql_query($query_lat);
----------------------------------------------------------------------------------------------------------



Here we make query and take WHERE cluse. Which category click on home page that's category's news show in category page. Before same work we were done.

No comments :

Post a Comment