Asked  7 Months ago    Answers:  5   Viewed   35 times

try {
   $dbh = new PDO('pgsql:host=localhost;port=5432;dbname=###;user=###;password=##');
   echo "PDO connection object created";
catch(PDOException $e)
      echo $e->getMessage();


I get the error message "Could Not Load Driver"



Try this:

Uncomment the following in php.ini by removing the ";"


Use the following code to connect to a postgresql database server:

pg_connect("host=localhost dbname=dbname user=username password=password")
    or die("Can't connect to database".pg_last_error());
Wednesday, March 31, 2021
answered 7 Months ago

I found the solution: How do I install MySQL modules within PHP?

Saturday, May 29, 2021
answered 5 Months ago

SQL Injection is only a problem where user-entered data needs to be sent to your database. A query like SELECT * FROM Player includes no user data. It's entirely safe from SQL Injection for that reason.

In fact, in this case, there's no benefit in using a prepared statement. A prepared statement here will make two calls to the database when one will do.

You can do this:

$getPlayers = $db->query("SELECT * FROM Player");
foreach ($getPlayers as $player) {
  // do something

No preparation, no binding, and just one call to the database.

Saturday, May 29, 2021
answered 5 Months ago

Check out the info on the PHP PostgreSQL installation page:

On a Windows server, configured with Apache, adding the following line to httpd.conf to load libpq.dll can save you a lot of time :

LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"

Note that you will have to change your folder accordingly to the installation path and version of PostgreSQL you have installed. Also note that having Apache and PostgreSQL on the same server for production environments is not recommended.

This fixed my setup instantly.

Monday, June 28, 2021
answered 4 Months ago

The following steps will enable the Designer in phpMyAdmin 4+ assuming that phpMyAdmin is inside the folder phpMyAdmin:

  • Open phpMyAdmin/ and phpMyAdmin/
  • Locate the phpMyAdmin configuration storage settings in (lines 38-66 in 4.0.7).
  • Copy all of the control user and storage db/table config and paste it into When you get done, your should include something like this:

4.0.7 Example:

/* change this info to whatever user has read-only access to the "mysql/user" and "mysql/db" tables */          
$cfg['Servers'][$i]['controluser']   = 'root'; //this is the default user for MAMP's mysql
$cfg['Servers'][$i]['controlpass']   = 'root'; //this is the default password for MAMP's mysql

/* this information needs to line up with the database we're about to create so don't edit it unless you plan on editing the SQL we're about to run */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';  
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';

Note: We are just telling phpMyAdmin what database and table names to store specific configuration details at. Now let's add the database.

  • phpMyAdmin installs with the SQL we need to generate the database that the Designer relies on. We just need to locate the script. In 4.0.7 the file location is phpMyAdmin/examples/create_tables.sql. Alternatively, you can copy/download this from phpMyAdmin's github.
  • Once you locate the file, either import the file or copy/paste it into a SQL window and execute in phpMyAdmin.
  • Now, everything should be configured properly. We need to clear cookies and restart the browser.
  • When you open phpMyAdmin back up, navigate to a specific table and in the tabs you should see Designer tab.

Disclaimer: These directions are specifically based on the new folder structure in phpMyAdmin 4+. You can apply the same directions by using phpMyAdmin's github config.sample.php and the accompanying create-table.sql. Choose your phpMyAdmin version by selecting the correct branch.

Sunday, August 8, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :