PHP
  Home arrow PHP arrow Page 2 - Building a Quick and Easy Tag Board
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

Building a Quick and Easy Tag Board
By: Haiden Taylor
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 120
    2004-11-03


    Table of Contents:
  • Building a Quick and Easy Tag Board
  • Did Anyone Say MySQL?
  • Our Tag Board Script
  • What Makes Our Tag Board Tick?
  • Our Tag Board Functions!
  • Retrieval and Sorting of Tags
  • Results
  • doBoard() Function
  • doInsert() Function
  • Ensuring Data Submitted Does Not Fail
  • Inserting into the Tag Board

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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 Easy Tag Board - Did Anyone Say MySQL?
    ( Page 2 of 11 )

    As mentioned briefly on the previous page, our tag board will take advantage of a MySQL database to store the information (tags). The MySQL table I will be using for this is below:

    CREATE TABLE `tagboard` (
    `tagId` int(11) NOT NULL auto_increment,
    `tag_name` varchar(55) NOT NULL default '',
    `tag_url` varchar(255) NOT NULL default '',
    `tag_entry` text NOT NULL,
    `tag_date` int(11) NOT NULL default '0',
    PRIMARY KEY (`tagId`)
    ) TYPE=MyISAM AUTO_INCREMENT=1 ;


    You will need to add this table to a MySQL database; you can do this through the MySQL console or through a program like phpMyAdmin.

    Our above table will store all our data (tags) indexed by a tagId, which is assigned to each tag by MySQL; this is commonly referred to as an “auto_increment” index. The reason I have included this column is because it is my preferred method of indexing, and it enables us to easily identify the tags if we were to create some admin functions (e.g. delete-tags.php?tagId=123).

    The next field in our table is “tag_name” which will store the users name, this is a varchar as most Internet users generally possess an Internet-only secret identity and generally write their “name” using a multitude of strange characters. Which is fine by us. The only restriction we have is the number of characters in that name, in our case 55; we administer this simply by setting maxlength=”55” in our HTML input tag (e.g. <input type="text" name="__name" size="20" maxlength="55" class="inputform">).

    Following this we have “tag_url” which will store the URL of the user, if applicable, meaning this is not a required field. It is a varchar also and is limited to 255 characters by maxlength=”255” again.

    Now we are storing the body of our tag in the “tag_entry” field. This field is of the text type; this is limited to 400 characters by our HTML input tags once again.

    The next field is where we are storing our date, “tag_date” which is of the int type, and 11 characters long. Some of you may be wondering why I have chosen to use “int” instead if “date” or “date-time”. The reason I have done this is because we are using the php Unix Epoch style of timestamp (time()) rather than the a MySQL timestamp.



     
     
    >>> More PHP Articles          >>> More By Haiden Taylor
     

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek