PEAR Articles
  Home arrow PEAR Articles arrow Page 4 - Listing Articles for a PEAR Content Ma...
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PEAR ARTICLES

Listing Articles for a PEAR Content Management System
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-11-19

    Table of Contents:
  • Listing Articles for a PEAR Content Management System
  • Code Explained
  • Table with Articles
  • After the Query is Run

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Listing Articles for a PEAR Content Management System - After the Query is Run


    (Page 4 of 4 )


    The query is run and the results are stored in the $res variable as shown below.


    $res = $db->query($sql);


    The $res variable is tested to see if it contains any records. If it does, the while loop is called to iterate through the results array and retrieve the data:


    if($res){

    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {

    ?>


    The while loop then iterates through the result set and builds the dynamic table with all the data that it retrieves from the result set:

     

    <tr>

    <td class="title"><a href="view.php?sid=<?php print $row->sid?>" class="title"><?php print $row->title ?></a></td>

    </tr>


    It's worth noting that the title listing also provides a hyperlink that links the authart page with the view.php page. The link has a query string attached that makes a sid or story_ID available to it:


    <td class="title"><a href="view.php?sid=<?php print $row->sid?>" class="title"><?php print $row->title ?></a></td>


    If the $res variable does not contain any records, then the code displays a message stating exactly that:


    <?php }

    }else{

    ?>

     

    <tr>

    <td colspan="2" class="auth"><p class="auth">No articles found</p></td>

    </tr>

    <?php } ?>

    </table>


    The HTML table is then closed and the HTML for the page is also closed.


    <!-- InstanceEndEditable --></td>

    </tr>

     

    <tr class="copy">

    <td colspan="2">&copy;2008</td>

    </tr>

    </table>

    </body>

    <!-- InstanceEnd --></html>

    In the next article we will look at the index and delete scripts. See you next week!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    PEAR ARTICLES ARTICLES

    - Deleting Authors from a PEAR Content Managem...
    - PEAR CMS: Index and Delete Scripts
    - Listing Articles for a PEAR Content Manageme...
    - Building an Authors Page for a PEAR CMS
    - Building the View Details Page in a PEAR CMS
    - Creating the Main Pages of a PEAR CMS
    - Completing the Login Script for a PEAR CMS
    - User Authentication for a PEAR CMS
    - A PEAR CMS: Examining the Code
    - Building a Content Management System with PE...
    - Installing a PEAR Package
    - My PEAR: The Beginning
    - Using XML_RPC2 with PEAR
    - Using Web Service APIs (Amazon and Yahoo!) w...
    - Database Abstraction with MDB2 from PEAR





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT