|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Programming Programmers can seek advice or just show off their creations inside this forum. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Ok let us start.
After a lot of frustration, I finally made up my mind to start this walk in the garden part 1 ... n threads. The frustration is about database connection. 1. The problem We have a lot of database platforms from the popular MySQL platform to the advanced Oracle enterprise database platform. And if you use the simple MySQL platform, there are more than one way to connect to the database. Here are 4 different ways to do it in PHP.
3. Related links A soft introduction to object oriented programming PHP 6 on the radar Building Object-Oriented Database Interfaces in PHP: Processing Data through Data Access Objects 4. The first walk. Here is the first walk without further comments, since the code is fairly well documented. Fine if you test the code and find any errors / bugs. I have found none so long. File: DbConnect.php PHP Code:
PHP Code:
6. The next walk or exercise for you. Test for MySQL PHP functions and improve connection. Hint: PHP Code:
__________________
Mini Network:: Financial information at your fingertips Learn object oriented programming where it started Last edited by kgun; 08-13-2009 at 12:51 PM. |
|
||||
|
Quote:
PHP example code for illustrative purposes that will not function: PHP Code:
Links:
Source: Matt Zandstra "PHP 5 Objects, Patterns, and Practice" chapter 4. Example: PHP Object return value As far as I know this problem will be solved in PHP 6 that also introduces the important concept of name spaces to avoid class collisions (in different libraries).
__________________
Mini Network:: Financial information at your fingertips Learn object oriented programming where it started Last edited by kgun; 08-14-2009 at 08:59 AM. |
|
||||
|
For those of you that want to use the pear MDB2 database abstraction layer
Install pear:
Scroll down to the pear section of the last site in my signature. Note: You can manipulate .htaccess with File_HtAccess I will not promise to write more regarding database connection etc. You should have enough information above. Related WPW thread: Is PHP a powerful tool?
__________________
Mini Network:: Financial information at your fingertips Learn object oriented programming where it started Last edited by kgun; 08-16-2009 at 08:00 AM. |
|
||||
|
I could not edit my last post. Here
__________________
Mini Network:: Financial information at your fingertips Learn object oriented programming where it started Last edited by kgun; 08-16-2009 at 10:14 AM. |
|
||||
|
Not a single comment or reaction to this important subject.
Quote:
PHP: PDO Drivers - Manual to find out which database drivers that are supported. If you have php 5.0, you can download the extension here: PECL :: The PHP Extension Community Library Finally, if you decide to use pear, you may register on the pear forum and vote here: PEAR Forum - Forum for PHP Extension and Application Repository It is a never ending poll, so hopefully the installation of pear, at least on a shared host will become more user friendly in the future. Note:
__________________
Mini Network:: Financial information at your fingertips Learn object oriented programming where it started Last edited by kgun; 08-17-2009 at 08:21 AM. |
|
||||
|
More on installing pear on a shared host: Installing pear on a shared host. - SitePoint Forums
Note The following two important cites from Matt Zandstra: "PHP 5 Objects, Patterns, and Practice" chapter 14. "An introduction to pear." Page 310 in my version: "The DB package is worth mastering. It provides a platform-agnostic interface to multiple databases. The idea is that you write code to work with the DB API, and it handles the database specific syntax. .............. This is an excellent example of good object-oriented design - an abstract class DB_COMMON defines an interface that supports the operations we have illustrated (in particular query() and nextIndex()), and a set of children provide the implementation. In this way your application is ready to work with MySQL, SQLite, MSSQL or Oracle with no change in your code (as long as you use standard SQL syntax). " So it is worth learning pear for many different reason. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can you "Walk the Walk"? | box4blox | Services for Sale/Hire | 1 | 05-20-2007 09:24 PM |
| NeuStep Walk-Through Technology | rbennett | Marketing Strategies Discussion Forum | 2 | 02-20-2006 02:02 PM |
| CSS Zen Garden Entry | Narasinha | Submit Your Site For Review | 1 | 03-27-2005 07:11 PM |
| web designers who take pay then walk away...solutions? | defcom2 | Search Engine Optimization Forum | 4 | 03-02-2005 10:22 AM |
| Home & Garden | bmwindows | Marketing Strategies Discussion Forum | 2 | 02-13-2004 10:39 AM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |