PHP Class SqlQuery
Home | University | GNU/Linux | Projects | Impressum |
- Safe Strings project
- Generate Background project
- PHP Class EasyTemplate
- PHP Class SqlQuery
- AOF-DB Project
- AOF-GUI Project
- SommerCampus 2006 :: CStrings
- SommerCampus 2006 :: Linux/Unix system programming
Synopsis
SQL Query is a PHP Class that helps when you have to work with SQL queries. The actual version handels only MySQL. Please inform yourself about the license of you MySQL version (and distribution) before using this class. A version of MySQL must be installed in your host server. This class was developed with MySQL Version 4.0.22.
License
GPL-2
Please read the license information before you use this source code!
PHP Versions
The class was developed with PHP Version 4.3.10 and 5.0.3, the class functions with both versions.
Why do I use it?
When you use SELECT FROM WHERE
queries then you have to fetch row by row the entrie information. Sometimes
you want to get everything in a single array (like LDAP-queries with OpenLDAP). With this class you get such a flavor, the class
executes the SQL querie (only by SELECT FROM WHERE
queries) you will get an array with the whole result of the
query with a LDAP flavor.
Download
Example
I use following content in the example
table.
BASH
This example has only one file:
1. index.php
index.php
When this code is parsed you get this:
output
<html>
<head>
<title>SqlQuery Example</title>
</head>
<body>
The content of <tt>example</tt> in the SqlQuery-Array is:<p>
<pre>
Array
(
[rows] => 3
[cols] => 4
[data] => Array
(
[id] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
[0] => id
[nick] => Array
(
[0] => Nick
[1] => Mei
[2] => Yugi
)
[1] => nick
[password] => Array
(
[0] => ssc
[1] => abcde
[2] => machomen
)
[2] => password
[name] => Array
(
[0] => Alexander
[1] => Michael
[2] => Daniela
)
[3] => name
)
)
</pre>
</body>
</html>