PHP
  Home arrow PHP arrow Page 4 - Building A Quick-And-Dirty PHP/MySQL P...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
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? 
PHP

Building A Quick-And-Dirty PHP/MySQL Publishing System
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 42
    2002-03-12

    Table of Contents:
  • Building A Quick-And-Dirty PHP/MySQL Publishing System
  • A Little Slug-gish
  • A Maniac Is Born
  • Bedtime Stories
  • Admin Ahoy!
  • Splitting Up
  • Erasing The Past
  • Changing Things Around
  • Game Over

  • 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


    Building A Quick-And-Dirty PHP/MySQL Publishing System - Bedtime Stories


    (Page 4 of 9 )

    You'll see, from the code on the previous page, that every press release title is linked to a script named "story.php" via its unique ID. This "story.php" script displays the complete text for the selected press release - and it looks like this:

    <?
    // story.php - display contents of selected press release
    ?>

    <!-- page header - snip -->

    <?
    // includes
    include("../conf.php");
    include("../functions.php");

    // open database connection
    $connection = mysql_connect($host, $user, $pass) or die ("Unable to
    connect!");

    // select database
    mysql_select_db($db) or die ("Unable to select database!");

    // generate and execute query
    $query = "SELECT slug, content, contact, timestamp FROM news WHERE id =
    '$id'";
    $result = mysql_query($query) or die ("Error in query: $query. " .
    mysql_error());

    // get resultset as object
    $row = mysql_fetch_object($result);

    // print details
    if ($row)
    {
    ?>
    <p>
    <b><? echo $row->slug; ?></b>
    <p>
    <font size="-1"><? echo nl2br($row->content); ?></font>
    <p>
    <font size="-2">This press release was published on <? echo
    formatDate($row->timestamp); ?>. For more information, please contact <?
    echo $row->contact; ?></font>
    <?
    }
    else
    {
    ?>
    <p>
    <font size="-1">That press release could not be located in our
    database.</font>
    <?
    }

    // close database connection
    mysql_close($connection);
    ?>

    <!-- page footer - snip -->
    Again, extremely simple - connect, use the ID to get the full text for the corresponding item, and display it. Here's what it looks like:



    With that, I've successfully completed the first part of this development effort. I now have a primitive publishing system that can be used to provide users of a Web site with news, press releases and other information.

    More PHP Articles
    More By icarus, (c) Melonfire


     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway