Jump to content

Using PDO


justlukeyou

Recommended Posts

Hi,

 

I have been advised that I should start using PDO which just requires a different access method to the database.  However, when I tried this it kick backed other errors.  Is there something else I should be doing, does my existing code need to change?

 

Is PDO widely used?

 

http://www.fullondesign.co.uk/coding/php/1907-pdo-php-data-objects-starter-guide.htm

 

 

Link to comment
Share on other sites

It would help if you actually stated what errors you were getting rather than just saying it doesn't work.  It would also help if you posted the code you were using (within [code][/code] blocks please).

 

You need to make sure you have enabled the proper drivers in your php.ini file for the database type you want to access.

 

Link to comment
Share on other sites

i have a few small issues with pdo, make sure you have the corresponding extensions enabled via your php.ini

 

not sure how many others use it, but i recently switch to it and it is perfect for my use. allows different database servers with ease, and also has support for prepared statements and transactions. (i am a former java dev; so its like home cooking :))

Link to comment
Share on other sites

Is it just like flicking a switch?  Just changing the connect method sounds to easy tbh

 

No, you have to update your code to use the new PDO object rather than the old mysql_* functions (or whatever you were using).

 

How complicated that is depends on how your currently using the functions.  If your using them directly on each page you'll have to update each page.  If you use a wrapper library you'd only have to update the wrapper.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.