<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/php/tags/database</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sat, 06 Sep 2008 19:34:15 GMT</pubDate>
<item>
<title>(PHP) Drupal function to return contents of a databasetable (for Debugging) - berkes</title>
<link>http://snipplr.com/view/7637/drupal-function-to-return-contents-of-a-databasetable-for-debugging/</link>
<description><![CDATA[ <p>Drupal helper function to debug a table. Returns the contents and some explanation of a database table in a rendered format (HTML table).

**NOTE** You REALLY do not want to put this function behind any kind of menu_callback and/or on other pages. Use it for debugging only: Because we return any contents, regardless of permissions and so forth, you potentially open up your site to data mining and or session hijacking!</p> ]]></description>
<pubDate>Fri, 01 Aug 2008 12:02:21 GMT</pubDate>
<guid>http://snipplr.com/view/7637/drupal-function-to-return-contents-of-a-databasetable-for-debugging/</guid>
</item>
<item>
<title>(PHP) PHP - Lightweight Database and Rowset class, ActiveRecord style functions - dom111</title>
<link>http://snipplr.com/view/7468/php--lightweight-database-and-rowset-class-activerecord-style-functions/</link>
<description><![CDATA[ <p>Been wanting to made one of these for a while and finally I got round to it.

For some examples please visit the post:
http://www.dom111.co.uk/blog/coding/db/8

Any comments suggestions appreciated.
CreativeCommons ShareAlike</p> ]]></description>
<pubDate>Wed, 23 Jul 2008 18:59:13 GMT</pubDate>
<guid>http://snipplr.com/view/7468/php--lightweight-database-and-rowset-class-activerecord-style-functions/</guid>
</item>
<item>
<title>(PHP) database class - ishkur</title>
<link>http://snipplr.com/view/7426/database-class/</link>
<description><![CDATA[ <p>it's still a work in progress. There are a lot of things I would like to do with it, but I think how I have it set up now is pretty good for how i need it. 

It's essentially the backbone of a CMS project I have going (PaamayimCMS). 

One major feature that I would LOVE to add to it is chainability. I've been looking at the P4A project, and they claim to have a database wrapper that functions in a similar way to jQuery in regards to that. 

In due time i suppose.</p> ]]></description>
<pubDate>Tue, 22 Jul 2008 03:09:45 GMT</pubDate>
<guid>http://snipplr.com/view/7426/database-class/</guid>
</item>
<item>
<title>(PHP) PEAR::DB MySQL Functions - mikegreen</title>
<link>http://snipplr.com/view/6419/peardb-mysql-functions/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 22 May 2008 11:26:26 GMT</pubDate>
<guid>http://snipplr.com/view/6419/peardb-mysql-functions/</guid>
</item>
<item>
<title>(PHP) PHP Class: MySQL DB Class - mattkenefick</title>
<link>http://snipplr.com/view/6416/php-class-mysql-db-class/</link>
<description><![CDATA[ <p>I deleted the old one by accident trying to edit it.</p> ]]></description>
<pubDate>Thu, 22 May 2008 10:25:37 GMT</pubDate>
<guid>http://snipplr.com/view/6416/php-class-mysql-db-class/</guid>
</item>
<item>
<title>(PHP) PHP MySQL Connect - mikegreen</title>
<link>http://snipplr.com/view/6380/php-mysql-connect/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 21 May 2008 10:33:15 GMT</pubDate>
<guid>http://snipplr.com/view/6380/php-mysql-connect/</guid>
</item>
<item>
<title>(PHP) Simple PHP ViewObject generator - donkawechico</title>
<link>http://snipplr.com/view/6033/simple-php-viewobject-generator/</link>
<description><![CDATA[ <p>Any time I make PHP applications that interact with a database, I use this script. It generates one or more self-populating "View Objects" (a class that represents a single record from a DB). For example, rather than access a MySQL record-set by array indices (e.g. $row[1]), you can populate an object with the record's values, and reference them like properties in an object (e.g. $productVO->price).

To use:
1. Create a ".vo" file. For example, if you have a Products table, make "products.vo". 
2. In this file, you will map column names to some string of your choice. This string will be used to name the getter/setter functions in the generated class. "get" and "set" will be pre-pended to these mapped names automatically, so don't include them. Like so:
[column 1 name]:[desired function name]
[column 2 name]:[desired function name] ...
e.g. 

file "product.vo":

id:Id
price:Price
desc:Description

This will generate a class with functions "getId()", "getPrice()", and "getDescription()", returning the appropriate attribute.
3. Edit the folder names in the python source below to match your setup
4. Run ./voGenerator.py -a

This will generate views for all ".vo" files in the directory specified in the python script as well as an "AllViews.php" file which, when included in your PHP code, imports all view files. View files take the form [filename]VO.php as in ProductVO.php

To populate these objects, use the following snippit:

function getAllProducts() {
		$products = array();
		$row = array();
		$result = query("SELECT * FROM products");

		while ($row = mysql_fetch_assoc($result)) {
			$pVO = new ProductsVO;
			$pVO->populate($row);
			array_push($products, $pVO);
		}

		return $products;
}</p> ]]></description>
<pubDate>Mon, 28 Apr 2008 18:54:13 GMT</pubDate>
<guid>http://snipplr.com/view/6033/simple-php-viewobject-generator/</guid>
</item>
<item>
<title>(PHP) PHP connecting and query MySQL DB - mswallace</title>
<link>http://snipplr.com/view/5488/php-connecting-and-query-mysql-db/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 18 Mar 2008 23:13:05 GMT</pubDate>
<guid>http://snipplr.com/view/5488/php-connecting-and-query-mysql-db/</guid>
</item>
<item>
<title>(PHP) Remove Duplicate Rows - Abe</title>
<link>http://snipplr.com/view/4819/remove-duplicate-rows/</link>
<description><![CDATA[ <p>$duplicates checks and groups duplicated rows with the same field1 and field2 (like comments maybe) and $limit counts how many times a row is duplicated.</p> ]]></description>
<pubDate>Tue, 29 Jan 2008 12:10:40 GMT</pubDate>
<guid>http://snipplr.com/view/4819/remove-duplicate-rows/</guid>
</item>
<item>
<title>(PHP) MySQL Class Cheat Sheet - Abe</title>
<link>http://snipplr.com/view/4808/mysql-class-cheat-sheet/</link>
<description><![CDATA[ <p>Cheat sheet for the MySQL Databse Class</p> ]]></description>
<pubDate>Mon, 28 Jan 2008 11:59:58 GMT</pubDate>
<guid>http://snipplr.com/view/4808/mysql-class-cheat-sheet/</guid>
</item>
<item>
<title>(PHP) Usefull functions to work with MySQL under PHP5 - LoRd1990</title>
<link>http://snipplr.com/view/4594/usefull-functions-to-work-with-mysql-under-php5/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 15 Jan 2008 09:55:45 GMT</pubDate>
<guid>http://snipplr.com/view/4594/usefull-functions-to-work-with-mysql-under-php5/</guid>
</item>
<item>
<title>(PHP) MYSQL Database Class - emuen</title>
<link>http://snipplr.com/view/2739/mysql-database-class/</link>
<description><![CDATA[ <p>This class operates a range of mysql functions base on arrays.

Example:


Name: 
Description:</p> ]]></description>
<pubDate>Sun, 27 May 2007 06:25:38 GMT</pubDate>
<guid>http://snipplr.com/view/2739/mysql-database-class/</guid>
</item>
<item>
<title>(PHP) MySQL Database Class - llbbl</title>
<link>http://snipplr.com/view/2725/mysql-database-class/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 25 May 2007 15:03:58 GMT</pubDate>
<guid>http://snipplr.com/view/2725/mysql-database-class/</guid>
</item>
<item>
<title>(PHP) Get HTML list of Array Keys - drwitt</title>
<link>http://snipplr.com/view/2141/get-html-list-of-array-keys/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 08 Feb 2007 04:50:20 GMT</pubDate>
<guid>http://snipplr.com/view/2141/get-html-list-of-array-keys/</guid>
</item>
<item>
<title>(PHP) ArticleHandler.class usage example - pietervp</title>
<link>http://snipplr.com/view/1787/articlehandlerclass-usage-example/</link>
<description><![CDATA[ <p>This is an example of how to use the articleHandler.class.php , this class can be found @ pietervp.com -> downloads</p> ]]></description>
<pubDate>Mon, 11 Dec 2006 10:02:29 GMT</pubDate>
<guid>http://snipplr.com/view/1787/articlehandlerclass-usage-example/</guid>
</item>
<item>
<title>(PHP) PHP - InversoMoltiplicativo - whitetiger</title>
<link>http://snipplr.com/view/1607/php--inversomoltiplicativo/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 09 Nov 2006 23:55:10 GMT</pubDate>
<guid>http://snipplr.com/view/1607/php--inversomoltiplicativo/</guid>
</item>
<item>
<title>(PHP) Get Dropdown Options From Database - tylerhall</title>
<link>http://snipplr.com/view/1400/get-dropdown-options-from-database/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 12 Oct 2006 13:59:09 GMT</pubDate>
<guid>http://snipplr.com/view/1400/get-dropdown-options-from-database/</guid>
</item>
<item>
<title>(PHP) Database Class - Corhol</title>
<link>http://snipplr.com/view/515/database-class/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 19 Jul 2006 23:42:21 GMT</pubDate>
<guid>http://snipplr.com/view/515/database-class/</guid>
</item>
<item>
<title>(PHP) sanitizeTags, version 1.0 (Daniel Mota aka IceBeat) - alvaroisorna</title>
<link>http://snipplr.com/view/213/sanitizetags-version-10-daniel-mota-aka-icebeat/</link>
<description><![CDATA[ <p>Taken from Daniel Mota at

http://icebeat.bitacoras.com/archivo/199/</p> ]]></description>
<pubDate>Tue, 04 Jul 2006 06:37:57 GMT</pubDate>
<guid>http://snipplr.com/view/213/sanitizetags-version-10-daniel-mota-aka-icebeat/</guid>
</item>
<item>
<title>(PHP) MySQL List Database Tables - neogeek</title>
<link>http://snipplr.com/view/177/mysql-list-database-tables/</link>
<description><![CDATA[ <p>Fetch a list of tables in a specific database.</p> ]]></description>
<pubDate>Sat, 01 Jul 2006 10:05:35 GMT</pubDate>
<guid>http://snipplr.com/view/177/mysql-list-database-tables/</guid>
</item>
</channel>
</rss>