View Single Post
Old 06-30-2008, 03:32 PM   #12 (permalink)
Ross
The Contributor
 
Ross's Avatar
 
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
Ross is on a distinguished road
Default

Quote:
Originally Posted by bluesaga View Post
Also, while on the topic of mysql and PHP5 - i would recommend everyone look at PHP: Mysqli - Manual it uses an object orientated approach to mysql.

The Mysqli format of doing this is especially helpful when working with multiple databases as instead of having to give a pointer to every query, you simply use the initialized db as a class ie:

Code:
$db       = new mysqli("localhost", "username", "password", "database", 3006);
$db2      = new mysqli("localhost", "username", "password", "database2", 3006);
$query    = $db->query("SELECT count(*) FROM example");
$query2   = $db2->query("SELECT count(*) FROM example");
echo $query->num_rows . "|" . $query2->num_rows;
I agree - it's very easy to work with and I generally prefer the object-oriented approach. However if you already have a multi-platform database class (e.g. a DAL) it's quite hard to implement as it uses seperate classes for results and the actual connection.
Ross is offline  
Reply With Quote