|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 280
|
Database solutions for two Sp Books.
I try to run the code examples for two of your books on line by my Danish shared hoster.
I don't intend to download and reinstall XAMP to test the code and my hoster only has support for mysql. In addition it seems that there is not a single central configuration file for database access, so you have to make many changes and maybe simulate the PDO and the mysqli_connect functionality. Question: Is there a fix without having to simulate PDO (first book) and rewrite much of the code to work with mysql_connect (second book) that depends on mysqli_connect etc. ? Proposal for further books: Make a single central database configuration file that test for PDO and mysqli_connect with functions like if (function_exists()) ... and set up the connection and code implementation based on those tests. In a sense like JS feature sniffing for browser compatibility. So is there any fix or do I have to reinvent the wheel and make my own solutions for the code in the above two books to function? |
|
|
|
|
|
#2 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 280
|
I used the following search term on my c disk: mysql
and noted the following: 1. There is an mysql.php file in Harry Fuchs SPLIB library /** * @package SPLIB * @version $Id: MySQL.php,v 1.1 2003/12/12 08:06:07 kevin Exp $ */ /** * MySQL Database Connection Class * @access public * @package SPLIB */ That seems like a good solution. I also have an old installation of pear and zend on my hard disk and find the following files pear: - pear/DB/mysql.php file - pear/DB/mysqli.php file - pear/MDB/MySQL.php file - pear/MDB/Modules/Manager/mysql.php file Zend - library/Zend/Db/Adapter/Mysqli.php file - library/Zend/Db/Adapter/Mysql.php file I don't know what these files do, but personally I would prefer a central configuration file that as a minimum combines a solution based on (a modified version of) the SPLIB MySQL.php file, a pear database connection class and DBO. That means that the code will test for the presence of one of these three implementations and use the preferred one if more than one is available. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| mysql mysqli pdo |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 18:29.









Hybrid Mode
