Location: PHPKode > scripts > MySQL Form Generator > mysql-form-generator/help.html
<html>
<head>
  <title>PHP DB Layer Help</title>
</head>
<body>
<h1>Object and Object Method Help</h1>
<hr>
<h3>Database Object</h3>
	<a href=#db_construct>Constructor</a> - 
	<a href=#db_select>select</a> -
	<a href=#db_put>put</a> -
	<a href=#db_get>get</a>
<h3>Form Object</h3>
	<a href=#form_construct>Constructor</a> -
	<a href=#form_addtable>addtable</a> -
	<a href=#form_describe>describe</a> -
	<a href=#form_equal>equal</a> -
	<a href=#form_makefields>makefields</a> -
	<a href=#form_build>build</a> -
	<a href=#form_submit>submit</a> -
	<a href=#form_Result>Result</a>
<h3>Table Object</h3>
	<a href=#table_construct>Constructor</a> -
	<a href=#table_submit>submit</a>
<h3>Field Object</h3>
	<a href=#field_construct>Constructor</a> -
	<a href=#field_SetValue>SetValue</a> -
	<a href=#field_SetVar>SetVar</a> -
	<a href=#field_build>build</a> -
	<a href=#field_GetValue>GetValue</a> -
	<a href=#field_Result>Result</a>
<br><br>
<hr>
<br><br>
<h2><font color=blue>MySQL Database Object:</font></h2>
<blockquote><font size=+2><b><a name=db_construct>Constructor</a></b></font> Method</blockquote>
<hr>
<i>Create this object with the following syntax:</i><br>
<br>
<code><font color=red>$db = new MySQLDB("DB Name","User Name","Password","Host");</font></code>
<ul>
<li><b>DB Name</b> : "mfgc" (name of the Database)</li>
<li><b>User Name</b> : "guest"</li>
<li><b>Password</b> : "guest"</li>
<li><b>Host</b> : "localhost" (or ip)</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=db_select>select</a></b></font> Method<br>
<font size=-1>Sets the database connection as the default.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$db->select()</font></code>
<br><br>
<hr>
<blockquote><font size=+2><b><a name=db_put>put</a></b></font> Method<br>
<font size=-1>Inserts or Updates a table/field in the database.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$db->put("SQL Query")</font></code>
<ul>
<li><b>SQL Query</b> : "insert into table1(id,t1_name) values('1','Name')"</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=db_get>get</a></b></font> Method<br>
<font size=-1>Selects a row from a table in the database.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$db->put("SQL Query")</font></code>
<ul>
<li><b>SQL Query</b> : "select * from table1 where id = '1'"</li>
</ul>
<hr>
<br><br>
<h2><font color=blue>Form Object:</font></h2>
<blockquote><font size=+2><a name=form_construct><b>Constructor</b></a></font> Method</blockquote>
<hr>
<i>Create this object with the following syntax:</i><br>
<br>
<code><font color=red>$form = new Form("Form Name","Title",Action,"Method","Encryption Type","Submit","CSS");</font></code>
<ul>
<li><b>Form Name</b> : "form" (name of the form object variable)</li>
<li><b>Title</b> : "Edit Tables"</li>
<li><b>Action</b> : "$PHP_SELF" (To which page will the form be posted)</li>
<li><b>Method</b> : "POST"</li>
<li><b>Encryption Type</b> : "text"</li>
<li><b>Submit</b> : "submit" (name of the submit variable)</li>
<li><b>CSS</b> : "form.css" (the Cascading Style Sheet to use)</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=form_addtable>addtable</a></b></font> Method<br>
<font size=-1>Creates a new Table Class and add's the name to the form's table list.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->addtable("DB Object","Table Name","Ignore Fields","Password Fields","Hidden Fields","Table Action","Where Clause","Order Clause","Limit Clause")</font></code>
<ul>
<li><b>DB Object</b> : "$db" (name of the Database Object)</li>
<li><b>Table Name</b> : "Table1"</li>
<li><b>Ignore Fields</b> : "0:5"  (doesn't create fields 0 and 5)</li>
<li><b>Password Fields</b> : "4" (turns field 4 into a password field)</li>
<li><b>Hidden Fields</b> : "3:2" (hides field 3 and 2)</li>
<li><b>Table Action</b> : ("1" = Insert), ("2" = Edit)</li>
<li><b>Where Clause</b> : "id = '1'" ('table field name' = 'value')</li>
<li><b>Order Clause</b> : "id desc" ('table field name' 'dec or asc')</li>
<li><b>Limit Clause</b> : "1,30" ('limit start, limit end')</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=form_describe>describe</a></b></font> Method<br>
<font size=-1>Sets the descriptions of each form input field.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->describe("Field Descriptions");</font></code>
<ul>
<li><b>Field Descriptions</b> : "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)</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=form_equal>equal</a></b></font> Method<br>
<font size=-1>Sets different fields to use the same variable or form input field.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->equal("Equal Array");</font></code>
<ul>
<li><b>Equal Array</b> : "$array" where $array = array("id" => "t1_name"); would set the id field and the t1_name field equal</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=form_makefields>makefields</a></b></font> Method<br>
<font size=-1>Compiles a list of all the field objects to be displayed in the form.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->makefields();</font></code>
<br><br>
<hr>
<blockquote><font size=+2><b><a name=form_build>build</a></b></font> Method<br>
<font size=-1>Compiles the HTML for a functional database insert/update form.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->build("Col1 Width","Col2 Width","Col3 Width","TextBox Rows","TextBox Cols");</font></code>
<ul>
<li><b>Col1 Width</b> : "200" (width in pixels)</li>
<li><b>Col2 Width</b> : "10" (width in pixels)</li>
<li><b>Col3 Width</b> : "200" (width in pixels)</li>
<li><b>TextBox Rows</b> : "3"</li>
<li><b>TextBox Cols</b> : "40"</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=form_submit>submit</a></b></font> Method<br>
<font size=-1>Enters the submitted form into the database.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->submit();</font></code>
<br><br>
<hr>
<blockquote><font size=+2><b><a name=form_Result>Result</a></b></font> Method<br>
<font size=-1>Compiles a the HTML Table containing all the submitted and updated values.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->Result("Col1 Width","Col2 Width","Col3 Width");</font></code>
<ul>
<li><b>Col1 Width</b> : "200" (width in pixels)</li>
<li><b>Col2 Width</b> : "10" (width in pixels)</li>
<li><b>Col3 Width</b> : "200" (width in pixels)</li>
</ul>
<hr>
<br><br>
<h2><font color=blue>MySQL Table Object:</font></h2>
<blockquote><font size=+2><b><a name=table_construct>Constructor</a></b></font> Method</blockquote>
<hr>
<i>Create this object with the following syntax:</i><br>
<br>
<code><font color=red>$db1 = new MySQLTable("DB Object","Table Name","Ignore Fields","Password Fields","Hidden Fields","Action","Where Clause","Order Clause","Limit Clause");</font></code>
<ul>
<li><b>DB Object</b> : "$db" (name of the Database Object)</li>
<li><b>Table Name</b> : "Table1"</li>
<li><b>Ignore Fields</b> : "0:5"  (doesn't create fields 0 and 5)</li>
<li><b>Password Fields</b> : "4" (turns field 4 into a password field)</li>
<li><b>Hidden Fields</b> : "3:2" (hides field 3 and 2)</li>
<li><b>Table Action</b> : ("1" = Insert), ("2" = Edit)</li>
<li><b>Where Clause</b> : "id = '1'" ('table field name' = 'value')</li>
<li><b>Order Clause</b> : "id desc" ('table field name' 'dec or asc')</li>
<li><b>Limit Clause</b> : "1,30" ('limit start, limit end')</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=table_submit>submit</a></b></font> Method<br>
<font size=-1>Compiles a the HTML Table containing all the submitted and updated values.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$table->submit("Form Object");</font></code>
<ul>
<li><b>Form Object</b> : "$form"</li>
</ul>
<hr>
<br><br>
<h2><font color=blue>MySQL Table Object:</font></h2>
<blockquote><font size=+2><b><a name=field_construct>Constructor</a></b></font> Method</blockquote>
<hr>
<i>Create this object with the following syntax:</i><br>
<br>
<code><font color=red>$db1 = new MySQLField("Field ID","Name","Type","Null","Key","Default","Extra","Length","Is Password?","Is Hidden?,"Value");</font></code>
<ul>
<li><b>Field ID</b> : "$db" (name of the Database Object)</li>
<li><b>Name</b> : "Table1"</li>
<li><b>Type</b> : Int, Double, Varchar, Text, Set or Blob etc</li>
<li><b>Null</b> : Is this field NULL or NOT NULL? </li>
<li><b>Key</b> : Is this field indexed or a key?</li>
<li><b>Default</b> : The default value for this field</li>
<li><b>Extra</b> : "auto_increment" (Indicates that this field is special)</li>
<li><b>Length</b> : "12" (Sets field maximum length to 12)</li>
<li><b>Is Password?</b> : ("0" = normal field, "1" = password field)</li>
<li><b>Is Hidden?</b> : ("0" = show field, "1" = hide field)</li>
<li><b>Value</b> : "$value" (field value)</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=field_SetValue>SetValue</a></b></font> Method<br>
<font size=-1>Updates the field object with a custom value.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->SetValue("Value");</font></code>
<ul>
<li><b>Value</b> : "$value"</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=field_SetVar>SetVar</a></b></font> Method<br>
<font size=-1>Updates the field object with a custom variable name.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->SetVar("Variable Name");</font></code>
<ul>
<li><b>Variable Name</b> : "$varname"</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=field_build>build</a></b></font> Method<br>
<font size=-1>Compiles the HTML for the specific field object's form input.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$field->build("Description","Col1 Width","Col2 Width","Col3 Width","TextBox Rows","TextBox Cols");</font></code>
<ul>
<li><b>Description</b> : "Username" (Heading describing this form input)</li>
<li><b>Col1 Width</b> : "200" (width in pixels)</li>
<li><b>Col2 Width</b> : "10" (width in pixels)</li>
<li><b>Col3 Width</b> : "200" (width in pixels)</li>
<li><b>TextBox Rows</b> : "3"</li>
<li><b>TextBox Cols</b> : "40"</li>
</ul>
<hr>
<blockquote><font size=+2><b><a name=field_GetValue>GetValue</a></b></font> Method<br>
<font size=-1>Updates the field object with the submitted form value.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$form->GetValue();</font></code>
<br><br>
<hr>
<blockquote><font size=+2><b><a name=field_Result>Result</a></b></font> Method<br>
<font size=-1>Compiles the HTML to display the specific field object's result.</font>
</blockquote>
<hr>
<i>Use this method with the following syntax:</i><br>
<br>
<code><font color=red>$field->Result("Description","Col1 Width","Col2 Width","Col3 Width");</font></code>
<ul>
<li><b>Description</b> : "Username" (Heading describing this form input)</li>
<li><b>Col1 Width</b> : "200" (width in pixels)</li>
<li><b>Col2 Width</b> : "10" (width in pixels)</li>
<li><b>Col3 Width</b> : "200" (width in pixels)</li>
</ul>
<hr>
</body>
</html>
Return current item: MySQL Form Generator