Location: PHPKode > scripts > Qexec > qexec/doc.html
<h1>Qexec PHP class - v1.0</h1>
<h2>Waht the class does - Main features</h2>
<p>
	<ul>
		<li>Executes MySQL queries</li>
		<li>Returns results and...</li>
		<li>if you want, assoc them into an multi-array</li>
		<li>All the queries are safer, due to a parsing</li>
	</ul>
</p>

<h2>Functions in the class</h2>
<h3>exec_query</h3>
<p>
	<code>
		function exec_query($query, $assoc = 1)
		<br /><br />
		@param string $query the SELECT query to execute<br />
	 	@param bool $assoc want the result to be assoc?<br />
	 	@return mixed the results, in a multi-array<br />
	</code>
	<br />
	Builds and returns the multiple array of results.<br />
	 	Found on http://it2.php.net/manual/en/function.mysql-query.php and modified to match the class
</p>

<h3>get_result</h3>
<p>
	<code>
		function get_result($query)
		<br /><br />
		@return mixed the results, in a multi-array<br />
	</code>
	<br />
	Actually executes the query and return the result
</p>

<h3>parse_mysql_query</h3>
<p>
	<code>
		function parse_mysql_query($query)
		<br /><br />
		@param string $query the SELECT query to execute<br />
		@return string the query, again, escaped<br />
	</code>
	<br />
	Parses the query and connects to the db
</p>

<h2>Examples of use</h2>
<p>
	The following code will returns affected_rows for anything other than select's.
	If you don't want any field name keys then specify 0 as the second parameter.
	<br /><br />
	<code>
		<?php<br />
		include_once('qexec.php');<br /><br />
	
		$q = new Qexec();<br />
		$res = $q->exec_query('SELECT foo,bar FROM table');<br /><br />

		echo $res[0]['foo']; // First row of the field 'foo'
	</code>
</p>

<p>
	For a single field select, returns the value
	<br /><br />	
	<code>
		include_once('qexec.php');<br /><br />
	
		$q = new Qexec();<br />
		$count = $q->exec_query('SELECT count(*) FROM table');
	</code>
</p>

<h2>Changelog</h2>
<p>
	No changes made since now.
</p>

<h2>License</h2>
<p>
	Copyright (C)2007 Giulio Bai <hide@address.com>
</p>

<p>
	<blockquote>
		This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation.
		<br /><br />
		This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
		<br /><br />
		You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</blockquote>
</p>

<p>
	A copy of the full license can be found in the <a href="http://www.gnu.org/licenses/gpl.html">official GNU's site</a>
</p>

<h2>Notes</h2>
<p>
	<h3>Links</h3>
	<ul>
		<li><a href="http://hewle.com">http://hewle.com</a> - My site :)</li>
		<li><a href="http://www.phpclasses.org">http://www.phpclasses.org</a> - Lots and lots of PHP classes</li>
		<li><a href="http://www.php.net">http://www.php.net</a> - PHP official site</li>
	</ul>
	
	<h3>Plase share it!</h3>
	<p>
		If you found this program useful, share it! Maybe it can help also other people!<br />
		Don't be scared, it's free, editable, redistributable.<br />
		So... share, Share, SHARE!	
	</p>
	
	<h3>Contacts</h3>
	<p>
		If you want to know more about this program, you can contact me at <a href="mailto:hide@address.com">hide@address.com</a>.<br />
		Wht do you think about this program? Is it useful? How can be improved?	
	</p>
</p>
Return current item: Qexec