Friday, February 21, 2014

Tute 18 : Create Dynamic Right Panel in Website : Part Two

Last tutorial we know "Create Dynamic Right Panel in Website". Now we edit This Right Panel. We see in right panel All article show here. But we will show here only one category's article or specific
article.

So now we some change in our php code. Open our index.php file in notepad++. Then include some  code in "$query_r="SELECT............" line. We write this code after "...FROM tute" :

----------------------------------------
WHERE `category`='html'
----------------------------------------

So our full line is :

------------------------------------------------------------------------------------------------------------
$query_r="SELECT `id`, `heading`, `image`, `details`, `category` FROM tute WHERE `category`='html' ORDER BY id DESC";
------------------------------------------------------------------------------------------------------------





This code we write where category = html. So where category is html only show this article here. Then save this file. After that go to the Google Chrome and refresh the home page. We see in right panel only two article show here. Because only two article where category is html in our database.

If we will write id number then show only this article. So we write this code :

------------------------------------------------------------------------------------------------------------
$query_r="SELECT `id`, `heading`, `image`, `details`, `category` FROM tute WHERE `id`=5 ORDER BY id DESC";
------------------------------------------------------------------------------------------------------------

 

 Again, if we write timing in where cluse then show latest article. In future we input time in our database. Then we will show article about time.

No comments :

Post a Comment