Object and Object Method Help
Database Object
Constructor -
select -
put -
get
Form Object
Constructor -
addtable -
describe -
equal -
makefields -
build -
submit -
Result
Table Object
Constructor -
submit
Field Object
Constructor -
SetValue -
SetVar -
build -
GetValue -
Result
MySQL Database Object:
Constructor Method
Create this object with the following syntax:
$db = new MySQLDB("DB Name","User Name","Password","Host");
- DB Name : "mfgc" (name of the Database)
- User Name : "guest"
- Password : "guest"
- Host : "localhost" (or ip)
select Method
Sets the database connection as the default.
Use this method with the following syntax:
$db->select()
put Method
Inserts or Updates a table/field in the database.
Use this method with the following syntax:
$db->put("SQL Query")
- SQL Query : "insert into table1(id,t1_name) values('1','Name')"
get Method
Selects a row from a table in the database.
Use this method with the following syntax:
$db->put("SQL Query")
- SQL Query : "select * from table1 where id = '1'"
Form Object:
Constructor Method
Create this object with the following syntax:
$form = new Form("Form Name","Title",Action,"Method","Encryption Type","Submit","CSS");
- Form Name : "form" (name of the form object variable)
- Title : "Edit Tables"
- Action : "$PHP_SELF" (To which page will the form be posted)
- Method : "POST"
- Encryption Type : "text"
- Submit : "submit" (name of the submit variable)
- CSS : "form.css" (the Cascading Style Sheet to use)
addtable Method
Creates a new Table Class and add's the name to the form's table list.
Use this method with the following syntax:
$form->addtable("DB Object","Table Name","Ignore Fields","Password Fields","Hidden Fields","Table Action","Where Clause","Order Clause","Limit Clause")
- DB Object : "$db" (name of the Database Object)
- Table Name : "Table1"
- Ignore Fields : "0:5" (doesn't create fields 0 and 5)
- Password Fields : "4" (turns field 4 into a password field)
- Hidden Fields : "3:2" (hides field 3 and 2)
- Table Action : ("1" = Insert), ("2" = Edit)
- Where Clause : "id = '1'" ('table field name' = 'value')
- Order Clause : "id desc" ('table field name' 'dec or asc')
- Limit Clause : "1,30" ('limit start, limit end')
describe Method
Sets the descriptions of each form input field.
Use this method with the following syntax:
$form->describe("Field Descriptions");
- Field Descriptions : "Row ID:/:/Row Surname:/:/Row Active?/:/Row ID:" (Descriptions start from zero, are seperated by the /:/ seperator and should include fields that are hidden or password, or share a variable)
equal Method
Sets different fields to use the same variable or form input field.
Use this method with the following syntax:
$form->equal("Equal Array");
- Equal Array : "$array" where $array = array("id" => "t1_name"); would set the id field and the t1_name field equal
makefields Method
Compiles a list of all the field objects to be displayed in the form.
Use this method with the following syntax:
$form->makefields();
build Method
Compiles the HTML for a functional database insert/update form.
Use this method with the following syntax:
$form->build("Col1 Width","Col2 Width","Col3 Width","TextBox Rows","TextBox Cols");
- Col1 Width : "200" (width in pixels)
- Col2 Width : "10" (width in pixels)
- Col3 Width : "200" (width in pixels)
- TextBox Rows : "3"
- TextBox Cols : "40"
submit Method
Enters the submitted form into the database.
Use this method with the following syntax:
$form->submit();
Result Method
Compiles a the HTML Table containing all the submitted and updated values.
Use this method with the following syntax:
$form->Result("Col1 Width","Col2 Width","Col3 Width");
- Col1 Width : "200" (width in pixels)
- Col2 Width : "10" (width in pixels)
- Col3 Width : "200" (width in pixels)
MySQL Table Object:
Constructor Method
Create this object with the following syntax:
$db1 = new MySQLTable("DB Object","Table Name","Ignore Fields","Password Fields","Hidden Fields","Action","Where Clause","Order Clause","Limit Clause");
- DB Object : "$db" (name of the Database Object)
- Table Name : "Table1"
- Ignore Fields : "0:5" (doesn't create fields 0 and 5)
- Password Fields : "4" (turns field 4 into a password field)
- Hidden Fields : "3:2" (hides field 3 and 2)
- Table Action : ("1" = Insert), ("2" = Edit)
- Where Clause : "id = '1'" ('table field name' = 'value')
- Order Clause : "id desc" ('table field name' 'dec or asc')
- Limit Clause : "1,30" ('limit start, limit end')
submit Method
Compiles a the HTML Table containing all the submitted and updated values.
Use this method with the following syntax:
$table->submit("Form Object");
MySQL Table Object:
Constructor Method
Create this object with the following syntax:
$db1 = new MySQLField("Field ID","Name","Type","Null","Key","Default","Extra","Length","Is Password?","Is Hidden?,"Value");
- Field ID : "$db" (name of the Database Object)
- Name : "Table1"
- Type : Int, Double, Varchar, Text, Set or Blob etc
- Null : Is this field NULL or NOT NULL?
- Key : Is this field indexed or a key?
- Default : The default value for this field
- Extra : "auto_increment" (Indicates that this field is special)
- Length : "12" (Sets field maximum length to 12)
- Is Password? : ("0" = normal field, "1" = password field)
- Is Hidden? : ("0" = show field, "1" = hide field)
- Value : "$value" (field value)
SetValue Method
Updates the field object with a custom value.
Use this method with the following syntax:
$form->SetValue("Value");
SetVar Method
Updates the field object with a custom variable name.
Use this method with the following syntax:
$form->SetVar("Variable Name");
- Variable Name : "$varname"
build Method
Compiles the HTML for the specific field object's form input.
Use this method with the following syntax:
$field->build("Description","Col1 Width","Col2 Width","Col3 Width","TextBox Rows","TextBox Cols");
- Description : "Username" (Heading describing this form input)
- Col1 Width : "200" (width in pixels)
- Col2 Width : "10" (width in pixels)
- Col3 Width : "200" (width in pixels)
- TextBox Rows : "3"
- TextBox Cols : "40"
GetValue Method
Updates the field object with the submitted form value.
Use this method with the following syntax:
$form->GetValue();
Result Method
Compiles the HTML to display the specific field object's result.
Use this method with the following syntax:
$field->Result("Description","Col1 Width","Col2 Width","Col3 Width");
- Description : "Username" (Heading describing this form input)
- Col1 Width : "200" (width in pixels)
- Col2 Width : "10" (width in pixels)
- Col3 Width : "200" (width in pixels)