PostgreSQL

Communicate with PostgreSQL using PHP

PostgreSQL is a common open source relational database system often used by PHP programmers.

Here we will discuss a PHP script to connect, insert data, retrieve data, and close the connection.

Let's create an example table in PostgreSQL and insert some dummy data:

create table example(
    id   serial,
    desc varchar(255) not null,
    qty  int          not null,
    primary key(id)
);

insert into example (desc, qty) values ('test1', 10);
insert into example (desc, qty) values ('test2', 1);
insert into example (desc, qty) values ('test3', 2);

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks