• Looking for a Top Flight Web Development Team?
  • Professional & Affordable Web Design Services
  • Shaping Imaginations using Cutting-Edge Technologies
  • Dynamic Solutions for Dynamic Businesses
  • Analysis.. then Solutions with a High Tech Flair
  • Satisfied Customers In Over 30 Countries
  • National Association of
    Accredited Internet Professionals
  • (561)948-6074
 
PHP Programming and Today's Internet Environment

PHP is one of the hottest scripting languages to be found on the Internet today. The fact that PHP code can be inserted directly alongside HTML makes the language all the more convenient.

 

Much of PHP is a combination of Perl, Java and C concepts. Some features of PHP include performing sophisticated mathematical calculations, providing network information, offering mail and regular expression capabilities, and much more.

 

PHP's strongest feature is its database interfacing capability. Connecting a database to the Internet has never been so easy. What's more, it supports many of the most popular database servers on the market, including MySQL (perhaps the most powerful database server found on the market today).

 

With Webdesignoffice's advanced PHP and MySQL programming you will get a top-notch dynamic, database-driven website.

 

MySQL Programming

 

PHP and MySQL: It's common just to jump right in and start building your MySQL tables with PHP My Admin without making considerations for future database growth or needs. Webdesignoffice recommends that you build these tables and relationships very carefully, and very prudently.

 

The following example will extend a MySQL database in the form of a PHP class. Basically, if you want to add a field to your MySQL database, the PHP class acts as a wrapper to your database and adds the field for you. Sound complex? Well, this must be done properly but it will add efficiencies to your programs.

 

Webdesignoffice uses PHP 4.1 and MySQL 3.23 or above. We are running a Linux Web server, but everything will also work on a Windows 2000 server with Apache/IIS.

 

Mysql Tables

 

When developing Web applications, it is tedious to add fields to a MySQL table as a new ideas appear.

 

The general idea is just to define a PHP class that contains the SQL-structure of your MySQL database, and have another object update the tables in your database automatically.

 

This is the WS Document and is a class to implement a document for my publishing engine.

 

This extends WS Dynamic Object line, which is the object that handles mySQL communication. Now, whenever we want to add a new field to my table for this class, It is simply.

 

Magic Mysql

 

Because we have added all the table fields of my class into my object WS Dynamic Object, we can use that list of fields to generate an automatic load and save function. Imagine the tedious task of handling a submit form and saving the result into your MySQL database.

 

The problem is easily solved with these dynamic classes. The object WS Dynamic Object runs through the list of fields you have defined in your class, and checks if this field is in the HTTP_GET_VARS or HTTP_POST_VARS array, if it is, then it loads the values to an instance of your class and runs the save() function.

 

How about updating records? Well, if you add a hidden field with the name of your unique field and the unique field value as its value, then the instance of your class will be given the unique value and the correct record will be updated. If this value is -1, then a new record is inserted into the database.

 

We've already seen how we add fields to the WS Dynamic Object class, but how does it work? This shouldn't be too hard to understand, simply showing the variables of the class and the add Field function. The save() algorithm that is used in form submission handling. The load() algorithm that is called in the constructor of my WS Document class. This simply runs through the record set that it fetched from the MySQL table and inputs the values into the object.

 

It says that the object is no longer new, and that it has loaded values - this makes sure that when the object is saved, the record set is updated and not inserted.

 

Here comes the tricky part -- keeping the structure defined in the object and the structure of the database and its tables in sync. The entire function, called syncTable works... believe us! Here's a basic overview of what the code does:

 

  • Create the table if it doesn't exist.
  • Get the list of fields from the table and store them in an array.
  • Run through the list of fields and match the names.
  • If the names match, see if the field types match (ex: int(11) == int(11))
  • If the field types match, nothing needs to be done.
  • If they don't match, update the field so they match.
  • If the field name is not found, then add the field to the table.
  • That's it! But there are some details I left out when showing you the class WS Dynamic Object.

 

Here is the complete variable list of the class:

 

  • class WS Dynamic Object {
  • var $fields; // an array of the fields in this structure
  • var $newobject; // is this a new object or loaded values from db?
  • var $table_fields; // the database equivalent of $this->fields
  • var $fields_ok; // control-list during update
  • var $missing_fields;// a list over the fields not added to the table
  • var $formmode;

 

The class variable called $formmode. 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 WS Dynamic Object called add Form Mode Field.

 

Users Option

 

If you are using Virtual Server hosting you probably have no sufficient privileges to create new databases on the target MySQL server. For this case we recommend the following approach:

 

Ask your Virtual Server administrator to create a blank database for you. Run Access-to-MySQL and select this database as the conversion target.

 

Click "Yes" when you will be asked if you'd like to overwrite existing MySQL database. When you complete these steps, the entire contents of the source MS Access database will be imported into the specified MySQL database.

 

Give us a shout!

Personal Details
captcha image
MySQL Access

Are you a small business using MS Access? Do you plan on expanding your business to facilitate more users and customers? Then you need to switch to a powerful, robust database. Webdesignoffice recommends switching from MS Access to MySQL as your database.

 

MySQL gives you all the power and functionality you need, plus it's free! Let the experts at Webdesignoffice help you switch over. Webdesignoffice has extensive experience with the MySQL database and will provide you with the exact solution you need at a price that won't deplete your budget.

 

Access to MySQL is a function to move MS Access databases to MySQL server. Depending on your privileges on the target MySQL server you can export MS Access data into new database or overwrite the contents of an existing MySQL database.

 

Features

All MS Access data types and attributes are supported

Works with all versions of Unix and Windows MySQL servers

 

Converts indexes with all necessary attributes

 

Merges MS Access data into an existing MySQL database

 

VServer user's option (see below)

 

Converts MS Access databases protected with user-level security

 

Exports MS Access databases into a dump file (see below)

 

Easy-to-use wizard-style interface

 

Full install/uninstall support

 

Limitations

Converts MS Access tables only (forms, queries, reports are not supported)

Does not convert system (hidden) tables

 

Does not convert relationships between tables

 

Requirements

Windows NT/2000/XP: Windows 2000/XP (or Windows NT 4 with Internet Explorer 5 or later)

Windows 95/98/Me: Windows 98/ME (or Windows 95 with Internet Explorer 5 or later)

MS Access 7.0 or higher (ODBC is not required)

At least 32 MB of available memory

 

MySQL Dump File

Access conversion to MySQL allows users to perform deferred conversion and get more control over the process. The program stores the contents of the source database into a local dump file instead of moving it to MySQL server directly.

The resulting file contains MySQL statements to create all tables and to fill them with the data. You will be able to import this file into existing MySQL database via MySQL client.

Back
to Top