colap Posted November 20, 2012 Share Posted November 20, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/270930-php-postgresql-database-connection/ Share on other sites More sharing options...
Muddy_Funster Posted November 20, 2012 Share Posted November 20, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/270930-php-postgresql-database-connection/#findComment-1393720 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.