Qexec PHP class - v1.0

Waht the class does - Main features

Functions in the class


function exec_query($query, $assoc = 1)

@param string $query the SELECT query to execute
@param bool $assoc want the result to be assoc?
@return mixed the results, in a multi-array

Builds and returns the multiple array of results.
Found on http://it2.php.net/manual/en/function.mysql-query.php and modified to match the class


function get_result($query)

@return mixed the results, in a multi-array

Actually executes the query and return the result


function parse_mysql_query($query)

@param string $query the SELECT query to execute
@return string the query, again, escaped

Parses the query and connects to the db

Examples of use

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.


$q = new Qexec();
$res = $q->exec_query('SELECT foo,bar FROM table');

echo $res[0]['foo']; // First row of the field 'foo'

For a single field select, returns the value


$q = new Qexec();
$count = $q->exec_query('SELECT count(*) FROM table');


No changes made since now.


Copyright (C)2007 Giulio Bai

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.

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.

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

A copy of the full license can be found in the official GNU's site



Plase share it!

If you found this program useful, share it! Maybe it can help also other people!
Don't be scared, it's free, editable, redistributable.
So... share, Share, SHARE!


If you want to know more about this program, you can contact me at slide.wow@gmail.com.
Wht do you think about this program? Is it useful? How can be improved?