Reply to Re: Using a Resource as a Class Property

Your name:

Reply:


Posted by Sanders Kaufman on 07/21/07 20:39

Sanders Kaufman wrote:

> function CreateTable($sTableName, $sTableDef){
> //Returns true, or false with an ErrorMessage.
> //Prefixes table name and appends ISAM engine type.
> //Auto-creates id field, but user should still provide a unique
> field
> $bRetVal = true;
> $this->RecordSQL = "CREATE TABLE {$this->TablePrefix}_$sTableName
> (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id),
> $sTableDef) ENGINE=MyISAM";
> if(!$this->RunSQL($this->RecordSQL)){
> $bRetVal = false;
> $this->ErrorMessage=mysql_error();
> } else {
> $this->ErrorMessage="OK";
> }
> return $bRetVal;
> }


This is actually one of the parts of my architecture I'm most proud of.
By specifying a table prefix in the class, it allows multiple web
applications to all use the same database, without any problem with same
names.

For example, suppose you use this framework to build a discussion forum
program. A client then uses it to build to web sites that use the same
database server (e.g. kaiser.kaufman.net and caesar.kaufman.net, both
using mysql.kaufman.net).

If the discussion forum uses a "users" table, then the developer can
isolate one from the other by specifying a unite table prefix.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация