Location: PHPKode > scripts > c_mysql > c_mysql/readme.htm
<html>
<head>
<title>c_mysql_readme</title>
<style>
	body{
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	color: #333333;
}
	hr{}
	td{
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	vertical-align: top;
	padding: 2px 4px;
}
	table{
	border: 1px solid #CCCCCC;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong>class c_mysql v3.0</strong></td>
  </tr>
  <tr> 
    <td>author:</td>
    <td>fizk</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">contact</td>
    <td bgcolor="#CCCCCC">hide@address.com</td>
  </tr>
  <tr> 
    <td>description: </td>
    <td>makes connection to MySql database and can run queries on it.</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">creation time:</td>
    <td bgcolor="#CCCCCC">1. feb. 2004</td>
  </tr>
  <tr> 
    <td>last modified:</td>
    <td>8. sep. 2004</td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td><strong>menu:</strong></td>
    <td><a href="#connection">class config:</a><br>
      <a href="#deb">debug variables:</a><br>
      <a href="#lim_var">limit variables</a><br>
      <a href="#format">format variables</a><br>
      <a href="#xml_var">xml variables</a><br>
      <br> <a href="#about_a">about array return</a><br> <a href="#about_x">about 
      xml return</a> <br>
      <br>
      methods:<br>
			&nbsp;&nbsp;&nbsp;<a href="#con">c_mysql (constructer)</a><br>
			&nbsp;&nbsp;&nbsp;<a href="#sel">c_mysql_SELECT()</a><br>
			&nbsp;&nbsp;&nbsp;<a href="#upd">c_mysql_UPDATE()</a><br>
			&nbsp;&nbsp;&nbsp;<a href="#del">c_mysql_DELETE()</a><br>
			&nbsp;&nbsp;&nbsp;<a href="#ins">c_mysql_INSERT()</a><br>
			&nbsp;&nbsp;&nbsp;<a href="#lim">c_mysql_LIMIT()</a><br>
      &nbsp;&nbsp;&nbsp;<a href="#cou">c_mysql_COUNT()</a><br>
      &nbsp;&nbsp;<a href="#per_page">&nbsp;c_mysql_per_page()</a> <br>
      &nbsp;&nbsp;&nbsp;<a href="#set_form">c_mysql_set_format()</a><br>
      &nbsp;&nbsp;&nbsp;<a href="#set_xsl">c_mysql_set_xsl()</a><br>
      <br>
      <br>
    </td>
  </tr>
</table>
<br>
<hr align="left" width="80%" noshade>
<br>
<strong>class config:</strong><br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="3" bgcolor="#FFCC00"><strong><a name="connection" id="connection"></a>connection 
      variables</strong></td>
  </tr>
  <tr> 
    <td><strong>variable name</strong></td>
    <td><strong>default</strong></td>
    <td><strong>usage</strong></td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">var $host</td>
    <td bgcolor="#CCCCCC">&quot;localhost&quot;</td>
    <td bgcolor="#CCCCCC">name of host<br>
      (this can be set by modifying the class or by the constructer function)</td>
  </tr>
  <tr> 
    <td>var $user</td>
    <td>&quot;root&quot;</td>
    <td>name of user<br>
      (this can be set by modifying the class or by the constructer function) 
    </td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">var $pass</td>
    <td bgcolor="#CCCCCC">&quot;&quot;</td>
    <td bgcolor="#CCCCCC">password for mysql<br>
      (this can be set by modifying the class or by the constructer function) 
    </td>
  </tr>
  <tr> 
    <td>var $db</td>
    <td>&quot;&quot;</td>
    <td>name of database<br>
      (this can be set by modifying the class or by the constructer function) 
    </td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">var $table</td>
    <td bgcolor="#CCCCCC">false</td>
    <td bgcolor="#CCCCCC">name of table</td>
  </tr>
  <tr> 
    <td colspan="3">These variables can be hard coded in the class, and then you 
      don't have to pass arguments in the constructer method... but if you plan 
      on using many databases in one session you have to populate the <a href="#con">constructer 
      method </a></td>
  </tr>
</table>
<br>
<table width="80%" border="0">
  <tr bgcolor="#FFCC00"> 
    <td colspan="3"><strong><a name="deb"></a>debug variables</strong></td>
  </tr>
  <tr> 
    <td><strong>variable name</strong></td>
    <td><strong>default</strong></td>
    <td><strong>usage</strong></td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>var $debugg</td>
    <td>1</td>
    <td>true for error report to the browser (echo), false for nothing</td>
  </tr>
  <tr> 
    <td>var $error_log_</td>
    <td>1</td>
    <td>true for writing an error log txt file, false for not</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>var $error_log_path</td>
    <td>c_mysql_error_log.txt</td>
    <td>path to error log text file</td>
  </tr>
</table>
<br>
<table width="80%" border="0">
  <tr bgcolor="#FFCC00"> 
    <td colspan="3"><strong><a name="lim_var" id="lim_var"></a>limit variables</strong></td>
  </tr>
  <tr> 
    <td><strong>variable name</strong></td>
    <td><strong>default</strong></td>
    <td><strong>usage</strong></td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>var $per_page</td>
    <td>5</td>
    <td>hard coded the number of entries that the <a href="#lim">c_mysql_LIMIT()</a> 
      method will display. This can be changed at runtime with the <a href="#per_page">c_mysql_per_page(int)</a> 
      method but has to be changed before the query is made</td>
  </tr>
</table>
<br>
<table width="80%" border="0">
  <tr bgcolor="#FFCC00"> 
    <td colspan="3"><strong><a name="format" id="format"></a>format variables</strong></td>
  </tr>
  <tr> 
    <td><strong>variable name</strong></td>
    <td><strong>default</strong></td>
    <td><strong>usage</strong></td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>var $format</td>
    <td>&quot;array&quot;</td>
    <td>Hard coded which format the <a href="#sel">c_mysql_SELECT()</a> and <a href="#lim">c_mysql_LIMIT()</a> 
      methods will return. These methods can return the result as an array or 
      an xml string<br>
      Possible values are -&gt; &quot;<strong>array</strong>&quot; or &quot;<strong>xml</strong>&quot;.<br>
      this can be changed at runtime with<a href="#set_form"> c_mysql_set_format()</a> 
      method.<br>
      <a href="#about_a">about array return</a><br> <a href="#about_x">about xml 
      return</a> </td>
  </tr>
</table>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="3" bgcolor="#FFCC00"><strong><a name="xml_var" id="xml_var"></a>xml 
      variables</strong></td>
  </tr>
  <tr> 
    <td><strong>variable name</strong></td>
    <td><strong>default</strong></td>
    <td><strong>usage</strong></td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">var $uni_format</td>
    <td bgcolor="#CCCCCC">&quot;iso-8859-1&quot;</td>
    <td bgcolor="#CCCCCC">the format of the xml string that is returned from the 
      c_msql_SELECT() and c_mysql_LIMIT() methods when the var $format property 
      is set as &quot;xml&quot;</td>
  </tr>
  <tr> 
    <td>var $uni_version</td>
    <td>&quot;1.0&quot;</td>
    <td>the version of the xml string that is returned from the c_msql_SELECT() 
      and c_mysql_LIMIT() methods when the var $format property is set as &quot;xml&quot;</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">var $uni_xsl</td>
    <td bgcolor="#CCCCCC">false</td>
    <td bgcolor="#CCCCCC">path to XSL file to format an XSL file</td>
  </tr>
</table>
<br>
<hr align="left" width="80%" noshade>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="3" bgcolor="#FFCC00"><strong><a name="about_a" id="about_a"></a>about 
      array return</strong></td>
  </tr>
  <tr> 
    <td colspan="3">If the class property <a href="#format">var $format</a> is 
      set to &quot;array&quot; or if the <a href="#set_form">c_mysql_set_format()</a> 
      is set to &quot;array&quot; at runtime the <a href="#sel">c_mysql_SELECT()</a> 
      and <a href="#lim">c_mysql_LIMIT()</a> metods will return a array similar 
      to this:</td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
    <td colspan="2"><kbd>Array<br>
      (<br>
      [0] =&gt; Array<br>
      (<br>
      [id] =&gt; 1<br>
      [name] =&gt; einar<br>
      [com] =&gt; &lt;&lt;&lt;&lt;&lt;&lt; &gt;&gt;&gt;&gt;&gt;&gt;<br>
      [dags] =&gt; <br>
      [a_dags] =&gt; 2004-09-08 01:40:37<br>
      ) </kbd>
      <p><kbd> [1] =&gt; Array<br>
        (<br>
        [id] =&gt; 2<br>
        [name] =&gt; solveig<br>
        [com] =&gt; &quot; ? ! &quot; # $ % &amp; / ( ) = @ ; : * ' ? ~ ^ `<br>
        [dags] =&gt; <br>
        [a_dags] =&gt; 2004-09-08 01:45:53<br>
        )</kbd></p>
      <p><kbd> [2] =&gt; Array<br>
        (<br>
        [id] =&gt; 3<br>
        [name] =&gt; &iacute;sid&oacute;r<br>
        [com] =&gt; <br>
        [dags] =&gt; <br>
        [a_dags] =&gt; 2004-09-08 01:25:03<br>
        )</kbd></p>
      <p><kbd>)</kbd></p></td>
  </tr>
  <tr> 
    <td colspan="3">If you plan on changing the format at run time you have to 
      change it before you make a query:<br>
      <kbd>$mysql_obj = new c_mysql();<br>
      $mysql_obj-&gt;c_mysql_set_format(&quot;array&quot;);<br>
      print_r($mysql_obj-&gt;c_mysql_SELECT(&quot;one_test&quot;,&quot;*&quot;)); 
      </kbd> </td>
  </tr>
</table>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="about_x" id="about_x"></a>about 
      xml return</strong></td>
  </tr>
  <tr> 
    <td colspan="2"> If the class property <a href="#format">var $format</a> is 
      set to &quot;xml&quot; or if the <a href="#set_form">c_mysql_set_format()</a> 
      is set to &quot;xml&quot; at runtime the <a href="#sel">c_mysql_SELECT()</a> 
      and <a href="#lim">c_mysql_LIMIT()</a> metods will return a xml string similar 
      to this:</td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
    <td><kbd>&lt;?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?&gt;<br>
      &lt;tester fields=&quot;5&quot; rows=&quot;3&quot;&gt;<br>
      &lt;one_test&gt;<br>
      &lt;id type=&quot;int&quot; length=&quot;9&quot; flags=&quot;not_null primary_key 
      auto_increment&quot;&gt;1&lt;/id&gt;<br>
      &lt;name type=&quot;string&quot; length=&quot;250&quot; flags=&quot;&quot;&gt;einar&lt;/name&gt;<br>
      &lt;com type=&quot;blob&quot; length=&quot;65535&quot; flags=&quot;blob&quot;&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; 
      &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/com&gt;<br>
      &lt;dags type=&quot;datetime&quot; length=&quot;19&quot; flags=&quot;&quot;&gt;&lt;/dags&gt;<br>
      &lt;a_dags type=&quot;timestamp&quot; length=&quot;19&quot; flags=&quot;not_null 
      zerofill timestamp&quot;&gt;2004-09-08 01:40:37&lt;/a_dags&gt;<br>
      &lt;/one_test&gt;<br>
      &lt;one_test&gt;<br>
      &lt;id type=&quot;int&quot; length=&quot;9&quot; flags=&quot;not_null primary_key 
      auto_increment&quot;&gt;2&lt;/id&gt;<br>
      &lt;name type=&quot;string&quot; length=&quot;250&quot; flags=&quot;&quot;&gt;solveig&lt;/name&gt;<br>
      &lt;com type=&quot;blob&quot; length=&quot;65535&quot; flags=&quot;blob&quot;&gt;&amp;quot; 
      ? ! &amp;quot; # $ % &amp;amp; / ( ) = @ ; : * &amp;#039; ? ~ ^ `&lt;/com&gt;<br>
      &lt;dags type=&quot;datetime&quot; length=&quot;19&quot; flags=&quot;&quot;&gt;&lt;/dags&gt;<br>
      &lt;a_dags type=&quot;timestamp&quot; length=&quot;19&quot; flags=&quot;not_null 
      zerofill timestamp&quot;&gt;2004-09-08 01:45:53&lt;/a_dags&gt;<br>
      &lt;/one_test&gt;<br>
      &lt;one_test&gt;<br>
      &lt;id type=&quot;int&quot; length=&quot;9&quot; flags=&quot;not_null primary_key 
      auto_increment&quot;&gt;3&lt;/id&gt;<br>
      &lt;name type=&quot;string&quot; length=&quot;250&quot; flags=&quot;&quot;&gt;&iacute;sid&oacute;r&lt;/name&gt;<br>
      &lt;com type=&quot;blob&quot; length=&quot;65535&quot; flags=&quot;blob&quot;&gt;&lt;/com&gt;<br>
      &lt;dags type=&quot;datetime&quot; length=&quot;19&quot; flags=&quot;&quot;&gt;&lt;/dags&gt;<br>
      &lt;a_dags type=&quot;timestamp&quot; length=&quot;19&quot; flags=&quot;not_null 
      zerofill timestamp&quot;&gt;2004-09-08 01:25:03&lt;/a_dags&gt;<br>
      &lt;/one_test&gt;<br>
      &lt;/tester&gt;</kbd></td>
  </tr>
  <tr> 
    <td colspan="2">If you plan on changing the format at run time you have to 
      change it before you make a query:<br> <kbd>$mysql_obj = new c_mysql();<br>
      $mysql_obj-&gt;c_mysql_set_format(&quot;xml&quot;);<br>
      print_r($mysql_obj-&gt;c_mysql_SELECT(&quot;one_test&quot;,&quot;*&quot;)); 
      </kbd><br>
      <br>
      Version and encoding can be changed by configuring the class see <a href="#xml_var">xml 
      variables</a><br>
      The base tag is the name of the database and entries are surrounded by the 
      table name.<br>
      <br>
      You can include a path to an XSL file by using the <a href="#set_xsl">c_mysql_set_xsl()</a> 
      method<br>
      or hard coded in the class. See <a href="#xml_var">xml variables</a></td>
  </tr>
  <tr> 
    <td colspan="2">Attributes:<br>
      <br>
      <strong>type:</strong> <br>
      For version 4.3.4, types returned are:<br>
      STRING, VAR_STRING: string<br>
      TINY, SHORT, LONG, LONGLONG, INT24: int<br>
      FLOAT, DOUBLE, DECIMAL: real<br>
      TIMESTAMP: timestamp<br>
      YEAR: year<br>
      DATE: date<br>
      TIME: time<br>
      DATETIME: datetime<br>
      TINY_BLOB, MEDIUM_BLOB, LONG_BLOB, BLOB: blob<br>
      NULL: null<br>
      Any other: unknown <br>
      <br>
      <strong>length:<br>
      </strong>length of field<br>
      <br>
      <strong>flags:<br>
      </strong>the special flags of that field, they are space seperated and you 
      will have to regexp split them if you want to use them<br>
      <br>
      <strong>fields:</strong><br>
      number of fields that were returnd in the query<br>
      <br>
      <strong>rows :<br>
      </strong>number of rows returned in the query</td>
  </tr>
</table>
<br>
<hr align="left" width="80%" noshade>
<br>
<strong>methods:</strong><br>
&nbsp;&nbsp;&nbsp;<a href="#con">c_mysql (constructer)</a><br>
&nbsp;&nbsp;&nbsp;<a href="#sel">c_mysql_SELECT()</a><br>
&nbsp;&nbsp;&nbsp;<a href="#upd">c_mysql_UPDATE()</a><br>
&nbsp;&nbsp;&nbsp;<a href="#del">c_mysql_DELETE()</a><br>
&nbsp;&nbsp;&nbsp;<a href="#ins">c_mysql_INSERT()</a><br>
&nbsp;&nbsp;&nbsp;<a href="#lim">c_mysql_LIMIT()</a><br>
&nbsp;&nbsp;&nbsp;<a href="#cou">c_mysql_COUNT()</a><br>
&nbsp;&nbsp;<a href="#per_page">&nbsp;c_mysql_per_page()</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#set_form">c_mysql_set_format()</a><br>
&nbsp;&nbsp;&nbsp;<a href="#set_xsl">c_mysql_set_xsl()</a><br>
<br>
<br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="con"></a>(constructer) 
      c_mysql([</strong>str<strong> host, </strong>str<strong> user, </strong>str<strong> 
      password</strong>, str<strong> database])</strong></td>
  </tr>
  <tr> 
    <td colspan="2">to make an object of this class:<br> <strong>$db_obj = new 
      c_mysql()</strong><br>
      the argument are not required, if no arguments are passed, the <a href="#connection">connection 
      variables</a> are used, but if you are to pass arguments to this method 
      you have to pass all three.</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">string[host]</td>
    <td bgcolor="#CCCCCC">name of the server (default : localhost)</td>
  </tr>
  <tr> 
    <td>string[user]</td>
    <td>name of the user (default : root)</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">string[password]</td>
    <td bgcolor="#CCCCCC">password to MySql database (default : )</td>
  </tr>
  <tr> 
    <td>string[database]</td>
    <td>name of database to select (default: )</td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="sel"></a>array c_mysql_SELECT(</strong>str<strong> 
      table, </strong>str<strong><strong> field</strong> [</strong>str<strong> 
      conditions, </strong>str<strong> order_by, [</strong>bool<strong> desc]])</strong></td>
  </tr>
  <tr> 
    <td colspan="2"> sends the SELECT query to the database and returns the result.<br>
      This method takes five arguments, last three are optional</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[table] </td>
    <td>the table you want to select from</td>
  </tr>
  <tr> 
    <td>string[fields]<br> </td>
    <td>what to select, this can be: &quot;*&quot; for all fields, or the<br>
      name of the field. If you desire multible fields, seperate them<br>
      with a comma within the string like so: &quot;field_1,field_2&quot;.<br>
      If many fields have the same value and you want each value only once<br>
      write a string like this: &quot;DISTINCT field&quot;</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">string[conditions]<br> </td>
    <td bgcolor="#CCCCCC"> the condition of your select query<br>
      ex: field = &quot;10&quot; or field &lt; &quot;10&quot;<br>
      this argument is optional, but if you plan on using the last two<br>
      arguments you have to pass an empty string to this one, like so: &quot;&quot;</td>
  </tr>
  <tr> 
    <td>string[oder]<br> </td>
    <td> the name of the field you wish to use to order the outcome<br>
      of the query. Text is not ordered by case,(A and a are the same)<br>
      but to force a case order apply a string like so: &quot;BINARY(field)&quot;</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">boolian[desc]</td>
    <td bgcolor="#CCCCCC"> if the str[oder] has a value this argument can be passed 
      a<br>
      boolian value to render the order descending or not. values can be:<br>
      true, false, 1 or 0. true and 1 for descending, false and 0 for not.<br>
      You can also not supply an argument, in whitch case the order will<br>
      be rendered not descending.</td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC"> <strong>return:<br>
      <br>
      xml-array/false</strong><br> <br></td>
    <td bgcolor="#CCCCCC"> on success array or xml <br>
      else return false.<br>
      <br> <a href="#about_a">about array return</a><br> <a href="#about_x">about 
      xml return</a> </td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="upd"></a>bool c_mysql_UPDATE(</strong>str<strong> 
      table, </strong>array<strong> value_array, </strong>str<strong> condition)</strong></td>
  </tr>
  <tr> 
    <td colspan="2"> Sends an update query to the database and returns 1 if success 
      else nothing.</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC">string[table]</td>
    <td bgcolor="#CCCCCC">name of table to update</td>
  </tr>
  <tr> 
    <td> array[value_array]<br></td>
    <td> an array holding the new values. This array has to be key indexed<br>
      where the key is the name of the field, and the value the new value, like 
      so: 
      <pre>
		Array
			(
				[id] => new_id
				[name] => new_name
			)
	  
	  </pre>
      the method will first match the array keys to the names of the fields in<br>
      the table, excluding keys that do not match...<br>
      let&acute;s say that you pass an 10 element array to this method, five of<br>
      the keys in that array match with field names in the table... those fields 
      in the table will be updated.<br>
      This is good when receiving an array from a POST request, &acute;cause you 
      <br>
      can do like this:<br>
      c_mysql_UPDATE(&quot;table&quot;, <strong>$_POST</strong>,id='foo')<br>
      and you don&acute;t have to worry about the submit element</td>
  </tr>
  <tr> 
    <td bgcolor="#CCCCCC"> string[condition]<br></td>
    <td bgcolor="#CCCCCC"> the condition (what goes after WHERE).<br>
      any valid SQL:<br>
      ex: myField='myValue' or myField&lt;'myValue' etc...</td>
  </tr>
  <tr> 
    <td><strong>return:<br>
      <br>
      true/false </strong></td>
    <td>on success true, else false</td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr bgcolor="#FFCC00"> 
    <td colspan="2"><strong><a name="del"></a>bool c_mysql_DELETE(</strong>str<strong> 
      table, </strong>str<strong> condition)</strong></td>
  </tr>
  <tr> 
    <td colspan="2"> sends a DELETE statement to the database</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[table]</td>
    <td> the table name that is to be deleted from, as a string.<br>
    </td>
  </tr>
  <tr> 
    <td>string[condition]</td>
    <td>the condition (what goes after WHERE).<br>
      any valid SQL:<br>
      ex: myField='myValue' or myField&lt;'myValue' etc...</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td><strong>return:<br>
      <br>
      true/false </strong></td>
    <td>on success true, else false</td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr bgcolor="#FFCC00"> 
    <td colspan="2"><strong><a name="ins"></a>bool c_mysql_INSERT(</strong>str<strong> 
      table, </strong>array<strong> insert_value)</strong></td>
  </tr>
  <tr> 
    <td colspan="2">
      send an INSERT statement to the database<br>
    </td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[table]</td>
    <td>table to insert new data<br>
    </td>
  </tr>
  <tr> 
    <td>array[insert_value]</td>
    <td>an array with the values that you want to insert<br>
      this array has to be key based where the key is the name of the<br>
      field and the value is the value to be inserted.<br>
      like so:
	  <pre>
				Array
					(
						[id] => 34
						[name] => name
					)

	  </pre>
      The array can be as under or over populeted as you want, but only<br>
      values that have the same name as a field in the database will be<br>
      inserted into the database. The rest will be inserted with &quot;&quot; 
      (blank value)<br>
      <strong>An error will arise if the field will not take NULL</strong><br>
      IF you are receiving values from a HTML form and the names of the<br>
      form fields are the same as the name of the database field you can do like 
      this:<br>
      c_mysql_INSERT(table, $_POST);</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td><strong>return:<br><br>
      true/false</strong></td>
    <td>on success true, else false</td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="lim"></a>c_mysql_LIMIT(</strong>str<strong> 
      table, </strong>str<strong> field, </strong>str<strong> where, </strong>str<strong> 
      order, [</strong>int <strong> number,[</strong> bool<strong> desc]])</strong></td>
  </tr>
  <tr> 
    <td colspan="2">simular to SELECT, but returns a limited result</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[ table]</td>
    <td>the table name that is to be deleted from, as a string.</td>
  </tr>
  <tr> 
    <td>string[field]</td>
    <td>what to select, this can be: &quot;*&quot; for all fields, or the<br>
      name of the field. If you desire multible fields, seperate them<br>
      with a comma within the string like so: &quot;field_1,field_2&quot;.<br>
      If many fields have the same value and you want each value only once<br>
      write a string like this: &quot;DISTINCT field&quot;</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[condition]</td>
    <td>the condition of your select query<br>
      ex: field = &quot;10&quot; or field &lt; &quot;10&quot;<br>
      this argument is optional, but if you plan on using the last two<br>
      arguments you have to pass an empty string to this one, like so: &quot;&quot;</td>
  </tr>
  <tr> 
    <td>string[order]</td>
    <td>the name of the field you wish to use to order the outcome<br>
      of the query. Text is not ordered by case,(A and a are the same)<br>
      but to force a case order apply a string like so: &quot;BINARY(field)&quot;</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>int[number]</td>
    <td>from where in the database to begin. default value is 0</td>
  </tr>
  <tr> 
    <td>bool[desc]</td>
    <td>if the str[oder] has a value this argument can be passed a<br>
      boolian value to render the order descending or not. values can be:<br>
      true, false, 1 or 0. True and 1 for descending, false and 0 for not.<br>
      You can also not supply an argument, in whitch case the order will<br>
      be rendered not descending.</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td><strong>return :<br>
      <br>
      xml-array/false</strong> </td>
    <td> on success array or xml <br>
      else return false.<br>
      <br> <a href="#about_a">about array return</a><br> <a href="#about_x">about 
      xml return</a> </td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>properties for<br>
      LIMIT: </td>
    <td> per_page = 5;<br>
      lim_total = false;<br>
      lim_pre = false;<br>
      lim_next = false;<br>
      lim_to = 0;<br>
      lim_from = 0;<br></td>
  </tr>
  <tr bgcolor="#CCCCCC">
    <td>use them like<br>
      this -&gt;</td>
    <td>
	
	&lt;?php<br>		$ix = ($_GET['ix']==&quot;&quot;)?0:$_GET['ix'];<br>		$db_obj = new c_mysql();<br>		$all_sel = $db_obj-&gt;c_mysql_LIMIT(&quot;archive&quot;,&quot;id&quot;,&quot;id&gt;2&quot;,&quot;id&quot;,$ix,true);</pre>
      <p> print_r($all_sel);</p>
      <p> if($db_obj-&gt;lim_pre) //is there a previus link<br>
        {<br>
        echo &quot;&lt;a href=&quot;. $_SERVER['PHP_SELF'].&quot;?ix=&quot;.$db_obj-&gt;lim_from.&quot; 
        &gt;pre&lt;/a&gt;&quot;;<br>
        }<br>
        <br>
        $pages = $db_obj-&gt;lim_total / $db_obj-&gt;per_page;<br>
        if($pages&gt;1)<br>
        {<br>
        for($a=0,$b=1;$a&lt;$pages;$a++,$b++)<br>
        {<br>
        $curr_ix = $db_obj-&gt;per_page * $a;<br>
        echo &quot;&lt;a href='&quot;. $_SERVER['PHP_SELF'].&quot;?ix=&quot; . 
        $curr_ix . &quot;'&gt; &quot;. $b.&quot;- &lt;/a&gt;&quot;;<br>
        }<br>
        }<br>
        <br>
        if($db_obj-&gt;lim_next) //is there a next link<br>
        {<br>
        echo &quot;&lt;a href='&quot;. $_SERVER['PHP_SELF'].&quot;?ix=&quot;.$db_obj-&gt;lim_to.&quot;'&gt;next&lt;/a&gt;&quot;;<br>
        }</p>
      <p> <br>
        ?&gt;<br>
      </p> </td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="cou" id="cou"></a>c_mysql_COUNT(</strong>str<strong> 
      table, </strong>str<strong> condition)</strong></td>
  </tr>
  <tr> 
    <td colspan="2">count rows with given condition</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[ table]</td>
    <td>the table name that is to be deleted from, as a string.</td>
  </tr>
  <tr> 
    <td>string[condition]</td>
    <td>any valid SQL that goes after &quot;WHERE&quot;;<br>
      id&lt;10; or<br>
      name=Oliver; </td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td><strong>return :<br>
      <br>
      int</strong> </td>
    <td> return a intiger value<br>
      in error it will return 0, but will write a error report if the error variables 
      are set to true.</td>
  </tr>
</table>
<br>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="per_page" id="per_page"></a>c_mysql_per_page(</strong>int<strong> 
      number </strong><strong>) </strong></td>
  </tr>
  <tr> 
    <td colspan="2">set number of entries returned</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>int[number]</td>
    <td>number of entries returned as an int</td>
  </tr>
</table>

<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="set_form" id="set_form"></a>c_mysql_set_format(</strong>str<strong> 
      format </strong><strong>)</strong></td>
  </tr>
  <tr> 
    <td colspan="2">set return format</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[format]</td>
    <td><p>to set at runtime if <a href="#sel">c_mysql_SELECT()</a> or <a href="#lim">c_mysql_LIMIT()</a> 
        will return an array or xml string<br>
        Possible values are -&gt; &quot;<strong>array</strong>&quot; or &quot;<strong>xml</strong>&quot;</p>
      <p>this can be hard coded in the class and the default is array.<br>
        <a href="#about_a">about array return</a><br>
        <a href="#about_x">about xml return</a> </p></td>
  </tr>
</table>
<br>
<table width="80%" border="0">
  <tr> 
    <td colspan="2" bgcolor="#FFCC00"><strong><a name="set_xsl" id="set_xsl"></a>c_mysql_set_xsl(</strong>str<strong> 
      path to xsl</strong><strong>)</strong></td>
  </tr>
  <tr> 
    <td colspan="2">set path to xsl file</td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td>string[path]</td>
    <td><p>if <a href="#sel">c_mysql_SELECT()</a> or <a href="#lim">c_mysql_LIMIT()</a> 
        return an xml string<br>
        you can set an XSL file to format it at run time with this method...<br>
        pass full path and file name.<br>
        <br>
        Pass false to not use XSL</p>
      <p>default is false</p>
      <p>this can be hard coded in the class under the variable $uni_xsl.<br>
        <a href="#about_x">about xml return</a> </p></td>
  </tr>
</table>
<br>
</body>
</html>


Return current item: c_mysql