unfinished draft of LiteMySQL

This commit is contained in:
2010-04-22 22:56:04 +03:00
parent f94d902589
commit 12e0e017f6

View File

@@ -0,0 +1,18 @@
---
layout: post
title: "LiteMySQL: ActiveRecord's Little Brother"
categories: [technology, database, php]
---
Ever needed a quick and lightweight MySQL library for PHP? Pulling out a full ORM is just overkill, but writing the PHP code needed to connect to the server, run a query, and process the results is a lot of hassle? I thought so. I've been there too.
So what if you could do something like this:
{% highlight php %}
<?php
$sql = new litemysql('host', 'username', 'password', 'testdb', 'books');
$books = $sql->find_all(array("author" => "John Twelve Hawks"));
?>
{% endhighlight %}
The above code would require about 8-10 lines of PHP code if you went barebones. I'm not gonna show a barebones example, cause frankly I'm even now too lazy to write such code.