MySQL
  Home arrow MySQL arrow Page 4 - Case Study: Handling MySQL Growth With a P...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
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? 
MYSQL

Case Study: Handling MySQL Growth With a PHP Class
By: Bjorn Roysland
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2002-11-12

    Table of Contents:
  • Case Study: Handling MySQL Growth With a PHP Class
  • Generic MySQL Tables
  • The Tricky Part
  • Formmode
  • Conclusion

  • 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


    Case Study: Handling MySQL Growth With a PHP Class - Formmode


    (Page 4 of 5 )

    What is the class variable called $formmode? Well, let's say that you want the field published to be a checkbox in your form. The tricky part is to check if the field is check or not checked, especially with the save() function we use in this object.

    To solve this, I added another method to WSDynamicObject called addFormModeField;

    function addFormModeField( $fieldname, $behaviour ) {
    $this->formmode[] = array($fieldname, $behaviour);
    }


    Although the naming of the function could have been better, the functionality works, and the method is used like this from the WSDocument class:

    // Form Mode Behaviour
    $this->addFormModeField("published","checkbox");


    This simply says that the field published should be treated as a checkbox, so when we add a form to create or update an instance of WSDocument, we call the method:

    $myobj->formMode();

    The function formMode() runs through the array formmode, and set the value to checked if the value is 1 and sets it blank if the value is 0. When the object is saved, the reversed action makes sure that checked = 1 in your MySQL table.

    More MySQL Articles
    More By Bjorn Roysland


     

    MYSQL ARTICLES

    - MySQL and BLOBs
    - Two Lessons in ASP and MySQL
    - Lord Of The Strings Part 2
    - Lord Of The Strings Part 1
    - Importing Data into MySQL with Navicat
    - Building a Sustainable Web Site
    - Creating An Online Photo Album with PHP and ...
    - Creating An Online Photo Album with PHP and ...
    - PhpED 3.2 – More Features Than You Can Poke ...
    - Creating An Online Photo Album with PHP and ...
    - Creating An Online Photo Album with PHP and ...
    - Security and Sessions in PHP
    - Setup Your Personal Reminder System Using PHP
    - Create a IP-Country Database Using PERL and ...
    - Developing a Dynamic Document Search in PHP ...







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