Location: PHPKode > projects > MyDB > docs/mydatalib_uk.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="StarOffice/5.1 (Win32)">
	<META NAME="AUTHOR" CONTENT="Philippe Lewicki">
	<META NAME="CREATED" CONTENT="20000522;5545499">
	<META NAME="CHANGEDBY" CONTENT="Philippe Lewicki">
	<META NAME="CHANGED" CONTENT="20000605;6102779">
	<STYLE>
	<!--
		@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 }
	-->
	</STYLE>
</HEAD>
<BODY>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><BR>
</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><FONT SIZE=5>MyDataLib
Documentation<BR></FONT></FONT><BR>
</P>
<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>

<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
	<COL WIDTH=85*>
	<COL WIDTH=85*>
	<COL WIDTH=85*>
	<THEAD>
		<TR VALIGN=TOP>
			<TH WIDTH=33%>
				<P>Class Mydataconnect</P>
			</TH>
			<TH WIDTH=33%>
				<P>class mydataTable</P>
			</TH>
			<TH WIDTH=33%>
				<P>Class mydataForm</P>
			</TH>
		</TR>
	</THEAD>
	<TBODY>
		<TR VALIGN=TOP>
			<TD WIDTH=33%>
				<P STYLE="margin-bottom: 0cm"><B>Methods :</B></P>
				<P>hostname
				<BR>login<BR>password<BR>db<BR>table<BR>server<BR>registryTable<BR><BR><B>Proprieties
				:<BR></B>start()	<BR>query()<BR>fetch()<BR><BR><BR>
				</P>
			</TD>
			<TD WIDTH=33%>
				<P><B>Methods<BR><BR></B>cfgBorder<BR>cfgBgcolorOne<BR>cfgBgcolorTwo<BR>cfgMaxRows<BR>cfgOrder<BR>cfgShowBlob<BR><BR>cfgOrderTable<BR>cfgEditRecord<BR>cfgDeleteRecord<BR>cfgLinkTableRecord<BR>cfgAddRecord<BR><BR>cfgConfirmDelete<BR><BR>cfgEditPage<BR>cfgAddPage<BR>cfgDeletePage<BR>cfgLinkTablePage<BR><BR>strShowingRecords<BR>srtTotal<BR>strEdit<BR>strPrevious<BR>strNext<BR>strDelete<BR>strDeleted<BR>strLinkedTable<BR>strPos1<BR>strEnd<BR>strInsertNewRow<BR>strYes<BR>strNo<BR>strDoYouReallyDelete<BR><BR><B>Propriety
				:<BR></B>displaytable(object mydataconnect, resultquery)<BR><BR><BR>
				</P>
			</TD>
			<TD WIDTH=33%>
				<P><B>Methods
				:<BR></B>submitPage<BR>resultpage<BR>readonlyField<BR>labelField<BR><BR>secondary_key<BR><BR>tblBorder<BR>tblWidth<BR>tblCellspacing<BR>tblCellpadding<BR><BR>frmTextareaCols<BR>frmTextareaRows<BR>fromFieldSize<BR>frmSubmitButton<BR><BR><B>Proprieties
				:<BR></B>printform(object mydataconnect, string where of the
				query)<BR>showform(object mydataconnect, string with the where
				sequence of a query) 
				</P>
			</TD>
		</TR>
	</TBODY>
</TABLE>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<H1>mydataconnect</H1>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<H2>Methodes 
</H2>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<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>
</P>
<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>
<H2>Proprieties</H2>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<H3>start() 
</H3>
<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>
<H3>startp() 
</H3>
<P STYLE="margin-bottom: 0cm">As start() properties but with a
persitante connection</P>
<H3>query()</H3>
<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>
<H3>fetch($result) 
</H3>
<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>
<H2>Exemple 
</H2>
<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>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
</P>
<H1>mydataForm</H1>
<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 :
adformtable.</P>
<H2>Methodes 
</H2>
<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
means.</P>
<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>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
</P>
<H2>Proprieties 
</H2>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<H3>printform($dbc, $wherequery) 
</H3>
<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
statement.</P>
<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>
<H3>Exemple 
</H3>
<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);
<BR>?&gt;<BR><BR>
</P>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
</P>
<H1>mydataTable 
</H1>
<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> 
</P>
<H2>Methods</H2>
<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>
</P>
<H3>Methods for the registry 
</H3>
<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>
<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
record.</P>
<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>
</P>
<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>
<H2>Properties 
</H2>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<H3>displaytable ($dbc, $dt_result) 
</H3>
<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>
<H2>Exemple 
</H2>
<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>
<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>
<P STYLE="margin-bottom: 0cm; page-break-before: always"><BR>
</P>
<H1>Registry 
</H1>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<H2>Introduction 
</H2>
<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 
</H2>
<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 
</P>
<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>
</P>
<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 
</P>
<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
table.</P>
<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
purpose.</P>
</BODY>
</HTML>
Return current item: MyDB