Jump to content

Recommended Posts

http://www.php.net/manual/en/pgsql.examples-basic.php

 

Is it the prefered/suggested/recommended way to connect with postgresql database with php?

 

Or should i use pdo or something else? http://www.php.net/manual/en/pdo.pgsqllobcreate.php

 

For mysql the pdo is recommeded by php users.

Link to comment
https://forums.phpfreaks.com/topic/270930-php-postgresql-database-connection/
Share on other sites

I don't have much experiance, or any actualy, with PSQL, but I will say that from the link you posted PDO looks like it would be the more secure option, and thus the recomended one. Because PDO uses bindings it adds another layer of security to the query that it sends, because it won't let string injections bind to int values and such. All user input should, of course, sill be safely sanitized outwith this as you shouldn't count on anyone but yourself to make your code safe.

 

Moreover, I personaly would suggest using PDO. It's a powerfull - if somewhat over complicated - class that, once you know it will standardise how you connect to and query databases quite a lot regardless of if it's PSQL, MYSQL or any other (except MS-SQL, unless/untill PDO has been updated to work with the sqlsrv driver extension).

 

That's my take on it anyway, hope it helps.

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.