PHP MySQL Database Class
April 19th, 2005A class for very basic MySQL database connectivity. Written to reduce redundant code in my own projects aswell as aid in debugging and error reporting during the developement phase. Currently connects to a database, execute external files containing SQL commands, insert and update from an array of key => value pairs, insert and update with sql command, query (one result), query (multiple rows), and dump a select query to a table. The zip file contains the class aswell as a demonstration script.
Download Version 1.0.4: db-1.0.4.zip
Do you like this code? Rate This Script at Hot Scripts.
![]() |
Categories
Popular Posts
RSS Feeds
Archives
November 27th, 2007 at 10:55 am
how can i make a class to insert data to database in php
November 27th, 2007 at 11:26 am
RE: serkan
The sample file included with the class shows how this is done.
December 1st, 2007 at 11:37 am
Hi,
Your script is working for me but I can't find which database was used to create the table users in ! I'm new to MySQL. Could you help me out with this?
January 14th, 2008 at 1:02 pm
Hi,
The script works perfectly fine on my PC, but online I get a "no database selected" error. I think it has something to do with the MySQL version of the server being quite old (3.23).
Could you tell me what I should change within the script?
January 15th, 2008 at 7:22 am
Are you sure you typed the database name correctly? Are you sure there is a database setup online?
January 16th, 2008 at 6:42 pm
This database class is a precious piece of php code.
May 2nd, 2008 at 7:03 am
Hi Micah, sorry for bother you but i get some rare error..
Parse error: syntax error, unexpected $end in C:\wamp\www\currency\include\db.class.php on line 458
Just including the file I get this.. any ideas?
Best regards and thanks for this..
May 22nd, 2008 at 2:31 pm
[...] the maze of duplicate entries I encountered yesterday through StumbleUpon, I came across this page, which reads: A class for very basic MySQL database connectivity. Written to reduce redundant code [...]
June 3rd, 2008 at 11:04 am
Hey, Micah,
Thanks for the class... It will be very usefull to me...
Thank you again!
June 19th, 2008 at 1:09 am
Hi Micah,
Thanks for your MySql Class.
One question. Is it only working on PHP 5 or also on lower versions ?
Raoul
June 28th, 2008 at 2:07 am
Thanks for a very clear tutorial. This is very helpful since I am making my code to OO design.
more power.
June 29th, 2008 at 10:33 am
Hi,
Is this still being used ?
Thanks
July 20th, 2008 at 3:05 pm
Many thanks - this will come in handy. Using it in a new play project I am creating....
-N@
September 4th, 2008 at 7:31 pm
Hi,
thank's your class, and please answer my question...
how to make query DELETE..
I was tried :
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/classmysql/db.class.php on line 137
Many thank's
October 9th, 2008 at 7:34 am
[...] PHP MySQL Database Class Esta es una clase muy b
October 9th, 2008 at 10:18 am
Good job, a nice handy class, i will use it on my scripts.
I found kind of bug, at select, when query fails, row_count remains the same, i think it`s better to set it to 0 ;
if (!$r) {
$this->last_error = mysql_error();
$this->row_count = 0;
return false;
}
October 10th, 2008 at 11:46 pm
hi
many many thanks
October 22nd, 2008 at 8:38 pm
Thanks mate