LiteMySQL — A quick and simple MySQL class for PHP5
December 13th, 2007
Today I released a small and quick side-project called LiteMySQL. It’s basically a PHP5 class which is designed to automate the boring repetitive tasks of opening and managing database connections, looping through the query result resource to get an array and so on.
I created this for a small project I’m working on which basically needs database access on less than a handful of pages. And so I’d have a ready to use MySQL solution other small projects in the future.
And sorry for the lack of information on the project page as of now, but I gotta finish off the original project which motivated me to create LiteMySQL. Once done I’ll update the project page with relevant information
Example Usage:
# general usage
$sql = new litemysql('host', 'username', 'password', 'database', 'table');
$rows = $sql->find_all();
# conditions
# - the following three uses of the find
# function all produce identical results
$result = $sql->find(3);
$result = $sql->find(array('id' => 3));
$result = $sql->find('`id` = 3');
# insert a single row
$sql->insert(
array(
'title' => 'hello world',
'body' => 'my first blog post :D',
'author' => 'John Doe'
)
);
December 13th, 2007 at 11:44 pm
I should be credited for coming up with such an awesome name.
December 14th, 2007 at 12:15 am
lol Fraeon, your suggestion was MyLiteSQL though
December 14th, 2007 at 11:47 am
Cute!
It’s pretty straight forward and simple!
I like the array conditions btw!
I’d really like to make this play with ms sql too
Is there a place (wiki, forum, mailing list, etc) for suggestions and stuff?
ps. Nice work
December 14th, 2007 at 1:52 pm
heh… glad you like it george
MSSQL isn’t a bad idea. I’ll be setting up a forum/wiki/something soon about LiteMySQL. I’m not even really sure what google code offers in that area yet, but worst case scenario i’ll setup a forum here just… lol
Gotta finish off the current site project at hand first just