Jump to content
Sign in to follow this  
WAMFT1

SQLI or PDO??

Recommended Posts

I have to start work on upgrading my work site and wonder whether to go SQLI or PDO? I don't know either so which would be easier to learn?

I may need some help to get some things working properly. Any tips or tricks would be appreciated.

Share this post


Link to post
Share on other sites

 see this reply -

On 11/13/2019 at 11:46 AM, mac_gyver said:

if you are faced with updating old code that uses the mysql extension, do yourself a favor and 1) jump directly to use the very simple and future-proof PDO extension, 2) use prepared queries when supplying external/unknown data to an sql query statement (this actually simplifies the sql query syntax), 3) using implicate binding (supply an array of values to the execute call) for prepared queries, and 4) use exceptions for errors and in most cases let php catch and handle the exception where it will use its error related settings to control what happens with the actual error information (database errors will 'automatically' get displayed/logged the same as php errors.) doing these four things greatly simplifies the implantation of your database specific code, which will let you eliminate, rather than convert code, shortening the task.

 

Share this post


Link to post
Share on other sites

Thanks mac_gyver. 

I will do some quick research on how to use PDO and try and update what I have.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • 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.