Location: PHPKode > projects > MyDB > docs/mydatalib_uk.html
	<META NAME="GENERATOR" CONTENT="StarOffice/5.1 (Win32)">
	<META NAME="AUTHOR" CONTENT="Philippe Lewicki">
	<META NAME="CREATED" CONTENT="20000522;5545499">
	<META NAME="CHANGED" CONTENT="20000605;6102779">
		@page { margin: 2cm }
		P { margin-bottom: 0.21cm; font-size: 10pt }
		H1 { margin-bottom: 0.21cm; font-family: "helvetica", sans-serif; font-size: 16pt }
		H2 { margin-bottom: 0.21cm; font-family: "helvetica", sans-serif; font-size: 14pt; font-style: italic }
		H3 { margin-bottom: 0.21cm; font-family: "helvetica", sans-serif; font-size: 12pt }
		TD P { margin-bottom: 0.21cm; font-size: 10pt }
		TH P { margin-bottom: 0.21cm; font-size: 10pt; font-style: italic }
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><BR>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><FONT SIZE=5>MyDataLib
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><FONT SIZE=5>Free
MyDB Project</FONT></FONT></P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">Author : Philippe Lewicki</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><BR>

<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
	<COL WIDTH=85*>
	<COL WIDTH=85*>
	<COL WIDTH=85*>
			<TH WIDTH=33%>
				<P>Class Mydataconnect</P>
			<TH WIDTH=33%>
				<P>class mydataTable</P>
			<TH WIDTH=33%>
				<P>Class mydataForm</P>
			<TD WIDTH=33%>
				<P STYLE="margin-bottom: 0cm"><B>Methods :</B></P>
				:<BR></B>start()	<BR>query()<BR>fetch()<BR><BR><BR>
			<TD WIDTH=33%>
				:<BR></B>displaytable(object mydataconnect, resultquery)<BR><BR><BR>
			<TD WIDTH=33%>
				:<BR></B>printform(object mydataconnect, string where of the
				query)<BR>showform(object mydataconnect, string with the where
				sequence of a query) 
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<H3>Connect to the database</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>hostname</B></FONT> =
&quot;localhost&quot;  		Name of the host <BR><FONT SIZE=2><B>login</B></FONT>
= &quot;&quot; 			Login to acces the database <BR><FONT SIZE=2><B>password</B></FONT>
= &quot;&quot;	 		Password to acces the database <BR><BR>
<H3>Create query in the database</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>db</B></FONT> =
&quot;databasename&quot; 	 	Database Name <BR><FONT SIZE=2><B>table</B></FONT>
= &quot;tablename&quot;		Table Name<BR><FONT SIZE=2><B>sql_query</B></FONT>
			SQL Query <BR><FONT SIZE=2><B>sql_order </B></FONT>			Order of 
the query (Order by sequence) <BR><FONT SIZE=2><B>pos </B></FONT>				record
position (Limit sequence).<BR>server =&quot;0&quot;<BR><FONT SIZE=2><B>id</B></FONT>				connexion
identifier<BR><FONT SIZE=2><B>result</B></FONT>				Query result
identifier, for the record set. <BR><FONT SIZE=2><B>insert_id</B></FONT>
			After an insert query its the uniq identifier
created.<BR><BR><FONT SIZE=2><B>registryTable</B></FONT> = &quot;registry&quot;
;	Name of the registry table.<BR><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm">Open a connexion to the database using
the methodes : <FONT SIZE=2><B>hostname</B></FONT>, <FONT SIZE=2><B>login</B></FONT>,
<FONT SIZE=2><B>password</B></FONT>.<BR>Return the connexion
identifier. It's affected to the methode <FONT SIZE=2><B>id</B></FONT>
<P STYLE="margin-bottom: 0cm">As start() properties but with a
persitante connection</P>
<P STYLE="margin-bottom: 0cm">Execute an SQL query <BR>Uses the
methodes : <FONT SIZE=2><B>id, sql_query, sql_order, sql_pos<BR></B></FONT>return
the result identifier. It affected the methode <FONT SIZE=2><B>result</B></FONT>.<BR>If
the SQL is an insert the new create uniq identifier of the primary
key table is insert in the method :<FONT SIZE=2><B> insert_id</B></FONT>.</P>
<P STYLE="margin-bottom: 0cm">Recieved the result identifier of a
query. By default it use the result method. <BR>Return the record as
an object. Using the fetch_object function.</P>
<P STYLE="margin-bottom: 0cm">Display all the name of the table
client.<BR>$conx= new mydataconnect ;<BR>$conx-&gt;table =
&quot;client&quot;;<BR>$conx-&gt;sql_query = &quot;select * from
client&quot; ;<BR>$conx-&gt;sql_order = &quot;order by name&quot;
;<BR>$conx-&gt;query() ;<BR>	while ($client = $conx-&gt;fetch(0))
{<BR>		  echo $client-&gt;nom.&quot;&lt;br&gt;&quot; ;<BR>	}<BR><BR>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
<P STYLE="margin-bottom: 0cm">This classe is use to display Forms.
<BR>It reads the fields of the Table and display the field according
to there type or to the information in the registry.<BR>To record or
update de data you must use it with the record classe.<BR>The form
uses CSS styles for the display. <BR>The column with labels uses the
style class : adformlabel.<BR>The column with the fields uses the
style class : adformfield<BR>The table use the style class :
<H3>Methods for the pages link to the form.</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>submitPage</B></FONT> =
&quot;mdfproceed.php3&quot; : name of the page for the ACTION in the
form. It's in this page that you can use the record classe to manage
the insert and updating. <BR><FONT SIZE=2><B>resultPage</B></FONT> :
name of the page to display after the inserting or
updating.<BR><FONT SIZE=2><B>requiredPage</B></FONT>  =
&quot;requiredfield.html&quot;  The page to show if one of the
required field is not fill.</P>
<H3>Mehods to directly access the registry bieaviours.</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>readonly	</B></FONT>Field
read only, he wont diplay in the form.<BR><FONT SIZE=2><B>labelfield	</B></FONT>Label
of the field <BR><FONT SIZE=2><B>picture </B></FONT> 	Field with a
file.<BR><FONT SIZE=2><B>listfield</B></FONT> 		List box with the
values from an other table.<BR><FONT SIZE=2><B>hidefield 	</B></FONT>Hidden
field<BR><FONT SIZE=2><B>required	</B></FONT>Required field<BR><FONT SIZE=2><B>default
		</B></FONT>Default value for the field<BR><FONT SIZE=2><B>optiontype</B></FONT>
	In table radio button or list box.<BR><FONT SIZE=2><B>emailfield
	</B></FONT>Set a field as email.</P>
<H3>Methods for the required fields :</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>requiredIndicator = &quot;*&quot;</B></FONT>
Char to display  to indicate that the field is
required.<BR><FONT SIZE=2><B>requiredLegend</B></FONT>  = &quot;(*)
are required&quot;  Note to indicate what the required indicator
<H3>Methods to display the tables with the fields :</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>tblBorder<BR>tblWidth<BR>tblCellspacing<BR>tblCellpadding<BR>frmTextareaCols
<BR>frmTextareaRows<BR>frmFieldSize<BR>frmSubmitButton </B></FONT>:
Text that will be shown in the sybmit button.<BR><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<H3>printform($dbc, $wherequery) 
<P STYLE="margin-bottom: 0cm"><BR>This methode display the form using
the mydataconnect object ($dbc). If the wherequery attribut is not
null it select the record. Usind the $wherequery string as a WHERE
<H3>showrecord($dbc, $wherequery)</H3>
<P STYLE="margin-bottom: 0cm">Works just like printform but only
display the data. <BR>Its usualy used to fast display the content of
a record table.</P>
<P STYLE="margin-bottom: 0cm">&lt;?<BR>	require(&quot;../mydatalib/mydatalib.inc.php3&quot;);
<BR>	$dbconect = new mydataconnect ; <BR>	$dbconect-&gt;db =
&quot;boutique&quot;;<BR>	$dbconect-&gt;table =
&quot;client&quot;;<BR>	$dbconect-&gt;start();    <BR>	$form1 = new
mydataForm ; <BR>	$form1-&gt;resultPage = &quot;thank.html&quot;;
<BR>	$form1-&gt;frmSubmitButton =
&quot;Save&quot;;<BR>	$form1-&gt;printform($dbconect, $wherequery);
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
<P STYLE="margin-bottom: 0cm">This class display the result of query
in an html table. <BR><BR>You can add some options like edit, delete,
add and linktables.<BR>The linktables will display the relational
reference associate with the select record.<BR> 
<H3>Methods to configure the display</H3>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>cfgBorder</B></FONT> =
&quot;0&quot; 		/* Border of the Table */<BR><FONT SIZE=2><B>cfgBgcolorOne</B></FONT>
= &quot;#CCCCCC&quot;	/* Background color of the line 1
*/<BR><FONT SIZE=2><B>cfgBgcolorTwo</B></FONT> = &quot;#DDDDDD&quot;	/*
Background color of the line 2 */<BR><FONT SIZE=2><B>cfgMaxRows</B></FONT>
= 30 		/* Maximum numbers of rows per page */<BR><FONT SIZE=2><B>cfgOrder</B></FONT>
= &quot;ASC&quot;	;	/* Default orders of the query's */<BR><FONT SIZE=2><B>cfgShowBlob</B></FONT>
= true 		/*  Show the content of blob fields (false to hide)
*/<BR><FONT SIZE=2><B>cfgWarpcels</B></FONT> = 0 		/* Limite la
longueur des cellules &agrave; une valeur fixe. */ <BR><BR>
<H3>Methods for the registry 
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>showlist	</B></FONT>		
To display a list box <BR><FONT SIZE=2><B>labelfield</B></FONT> 		
The title of the colomn <BR><FONT SIZE=2><B>hidefield</B></FONT>  		
Hide some field to the display</P>
<H3>Methods for the options</H3>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm"><FONT SIZE=2><B>cfgOrderTable</B></FONT>
= true 		Display a link so you can order the column of the
table.<BR>cfgOrder<BR><FONT SIZE=2><B>cfgEditRecord</B></FONT> = true
 		Display a link to update de record.<BR><FONT SIZE=2><B>cfgDeleteRecord</B></FONT>
= true  		Display a link to delete the record.<BR><FONT SIZE=2><B>cfgLinkTableRecord</B></FONT>
= true  	Display a link to the relational linked tables.
<BR><FONT SIZE=2><B>cfgAddRecord</B></FONT> = true 		Display a link
to add a record.<BR><FONT SIZE=2><B>cfgConfirmDelete </B></FONT>=
&quot;Yes&quot; 	Display a dialogue box to confirm before deleting a
<H3>Methods for the urls and pages.</H3>
<P STYLE="margin-bottom: 0cm">cfgEditPage = &quot;mydataedit.php3&quot;
			URL to the edit page, must contain a form class<BR>cfgAddPage =
&quot;mydataedit.php3&quot;			URL to the add page, must contain a
form class<BR>cfgDeletePage = &quot;mydatadelete.php3&quot;		URL to
the delete page<BR>cfgLinkTablePage = &quot;mydatalinktable.php3&quot;	URL
to the linked tablesl.<BR><BR>
<H3>Methods with the displayed texts</H3>
<P STYLE="margin-bottom: 0cm">strNoRecords = &quot;Il n'y a aucun
enregistrement&quot;; <BR>strShowingRecords	= &quot;Affichage des
enregistrements&quot;;<BR>strTotal		= &quot;total&quot;;<BR>strEdit		=
&quot;Modifier&quot;;<BR>strPrevious	= &quot;Pr&eacute;c&eacute;dent&quot;;<BR>strNext		=
&quot;Suivant&quot;; <BR>strDelete		= &quot;Effacer&quot;;<BR>strDeleted		=
&quot;L'enregistrement a &eacute;t&eacute; effac&eacute;&quot;;<BR>strLinkedTable
	= &quot;Tables Li&eacute;s&quot;; <BR>strPos1                	=
&quot;D&eacute;but&quot;;<BR>strEnd                 	=
&quot;Fin&quot;;<BR>strInsertNewRow	= &quot;Ins&eacute;rer un nouvel
enregistrement&quot;;<BR>strYes		= &quot;Oui&quot;;<BR>strNo		=
&quot;Non&quot;;<BR>strDoYouReallyDelete = &quot;Voulez vous vraiment
supprimer l'enregistrement &quot;; <BR><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<H3>displaytable ($dbc, $dt_result) 
<P STYLE="margin-bottom: 0cm">This display the table with
mydataconnect object ($dbc) and result identifier from a database
query.<BR>The table will be displayed according to the information in
the registy table.</P>
<P STYLE="margin-bottom: 0cm">To fully work the exemple need this
files : checkdelete.php3; mydatadelete.php3, mydataedit.php3,
mydatalib.inc.php3, mydatalinktable.inc.php3, mydatalinktable.php3,
mydataproced.php3, showdialogdelete.php3<BR><BR>
<P STYLE="margin-bottom: 0cm">&lt;?php
<BR>	require(&quot;../mydatalib/mydatalib.inc.php3&quot;);<BR>	$conx
= new mydataconnect;<BR>	$conx-&gt;start() ; <BR>	$conx-&gt;table =
client ; <BR>	$table = new mydataTable; <BR>	$conx-&gt;sql_query =
$sql_query;<BR>	$conx-&gt;sql_order = $sql_order ; <BR>	$conx-&gt;pos
= $pos ;     <BR>	$table-&gt;cfgBgcolorOne = &quot;#D0F5C5&quot;
;<BR>	$table-&gt;cfgBgcolorTwo = &quot;#C7F5E7&quot;
;<BR>	$table-&gt;cfgShowBlob = true; <BR>	$table-&gt;cfgLinkTableRecord
= false ; <BR>	$result = $table-&gt;query($conx) ;
<BR>	$table-&gt;displaytable($conx, $result) ; <BR>?&gt;<BR><BR>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
<P STYLE="margin-bottom: 0cm"><BR>
<P STYLE="margin-bottom: 0cm">The registry is the heart of the mydb
project:<BR>It records all the types, beaviors of the different
fields.<BR>Usualy you dont need to access directly the registry
table. You use the MyDB IDE to set all the parameters of the fields.</P>
<H2>The Regisrty Table 
<P STYLE="margin-bottom: 0cm">The reigrty has 5 fields:<BR>registryid
: unique identifier of the field.<BR>rtable :  Name of the table  
<BR>rfield : Name of the field<BR>rtype : field type type<BR>rdata :
extra parameters for the feild types.<BR>All the extra parameters are
separate by semicolon  ( ' : ').</P>
<H2>readonly type</H2>
<P STYLE="margin-bottom: 0cm">Its used to hide the  field for
modifications.<BR>parameters  :<BR>	none, just use : 1 
<H2>list type</H2>
<P STYLE="margin-bottom: 0cm">Create a list box with the values of an
other table:<BR><BR>The parameters are separate by  &quot; : &quot;
:<BR>use : &lt;table name1&gt;:&lt;Field name1&gt;:&lt;Field
name2&gt;:&lt;Default value&gt;<BR>-&lt;table name1&gt; Name of the
other table <BR>- &lt;Field name1&gt; Name of the  field with the
value that will be insert <BR>- &lt;Field name2&gt; Name of the field
with the value to display <BR>- &lt;Default value&gt; Value in the
&lt;field name1&gt; format that will be selected by default</P>
<H2>picture  type</H2>
<P STYLE="margin-bottom: 0cm">The picture type let you upload files
to the server.<BR>Parameters :<BR>&lt;directory name&gt;:[&lt;prefix
of the file name&gt;]<BR>	Directory where the files will be uploads (
You must be able to write)<BR>	Suffix of the file on the server. By
default it will the name of the file that is uploads.<BR>	File
extention . Optionnal <BR>Exemple : <BR>demo/picture:product.jpg<BR>On
the server the file while have the folowing name :<BR>n&lt;primary
index value&gt;product.jpg<BR><BR>If you dont want to use the suffixe
you can just give the directory name :<BR>demo/pricture</P>
<H2>hidefield  type:</H2>
<P STYLE="margin-bottom: 0cm">To hide a field from the forms, tables,
reports.<BR>The only parameter is  : 1 <BR><BR>
<H2>showpicture  type</H2>
<P STYLE="margin-bottom: 0cm">Display the picture in the field. The
feild must already be a picture type.<BR>The only parameter is : 1</P>
<H2>label  type</H2>
<P STYLE="margin-bottom: 0cm">This type is for display a text label
in the forms. By default the name of the file is displayed. <BR>The
parameter is a string with the label.</P>
<H2>Datef type</H2>
<P STYLE="margin-bottom: 0cm">Define the format of the date for the
field.<BR>The date is automaticly converted in a unix timestamp.<BR>The
parameter is the date format 
<H2>optiontype type :</H2>
<P STYLE="margin-bottom: 0cm">To create list box or radio button with
the data inside the table format (usign mysql Enum).<BR>The parameter
is :<BR>radiobutton : to display the enum in a radiobutton<BR>listbox
: to display the enum in a list box.</P>
<H2>language type :</H2>
<P STYLE="margin-bottom: 0cm">Used to tel in witch language is the
content of the field.<BR>The parameter is the language
abbreviation.<BR>There are the sames as the domains names<BR>fr :
Fran&ccedil;ais<BR>uk : english<BR>de : germain...</P>
<H2>currency type:</H2>
<P STYLE="margin-bottom: 0cm">Used to tel in witch currency in the
field.<BR>The parameter is the abbreviation set in the currency
<H2>required type :</H2>
<P STYLE="margin-bottom: 0cm">The field is required and cannot be
empty.<BR>The parameter is 1.</P>
<H2>default type :</H2>
<P STYLE="margin-bottom: 0cm">Its the default value of the field<BR>The
parameter is the default value.</P>
<H2>email type</H2>
<P STYLE="margin-bottom: 0cm"> The content of the field is an email.
A verification is done to find a valid domain name.<BR>The parameter
is one.</P>
<H2>access Type</H2>
<P STYLE="margin-bottom: 0cm">The content of the field is a Login or
a Password. There must be both in the same table. When saving the
record mydatarecord verify that there is only one unique login and
password<BR>Used to create a login and password for identifications
Return current item: MyDB