A$ wr wb
Beuh someone said “it will be better if your blog is written in English”….but if i forced my blog to be written in English….oh god I was realize that my English not really good….plus, I dunno how to express some terrible word like I usually did on my previous post….
but anyway on the other point, i think it will be great for me to improve my English writing experience….especially to express something in English as I want…..he he
so for anyone who use English as ur native language and advance in English….pardon me okay…..
Enough with the prologue…now we just jump to our main topic….my “sok teknikal” post. In this opportunity, i would like to share about the integration of PHP (my fave) with PostgreSQL for their database….Again this post is pointed for the newbie (just like me)….so if u are master on those two things (PHP + PostgreSQL) u allow to read this and give a comment is a must..
Installing PostgreSQL
————————————–
Before u install postgre, u need to do some prerequisite activity….
1. Wash your hand
2. Pray
3. Download PostgreSQL installer here http://www.postgresql.org/download/
In this case, just click on the installer launcher and follow the instruction. The default port for PostgreSQL will be 5432 (just keep it like that, as you see it was a beautiful port number he he)
Preparing integration with PHP
———————————————-
Before work with PHP first you must check whether php_pgsql.dll is already installed or not. You can check it on your “php/extensions/” folder. After you sure that those extension already installed, next you need to activate it on PHP.ini. to activate you can add this line on your PHP.ini “extension=php_pgsql.dll” or when it already exist, you can just open the comment tag in front of those line.
ok now you ready to operate PostgreSQL using PHP…..
Database Connection to PestgreSQL
—————————————————-
Now open your PHP editor…and start creating new project….called myfirstphppostgre.php (if you think the file name is too long you can change it – it’s really recommended to because i feel the same he he)
+ Connect to PostgreSQL
ok now we begin to connect our PHP with PostgreSQL. As you know to connect in to some database we need this variable:
$dbhost = host where your database is stored
$dbuser = user of your database server
$dbpassword = password of your database server (if possible you need to encrypt this)
PostgreSQL connection string is little bit different from SQLServer or MySQL. here the function to connect into PostGreSQL

Then test your connection

+ PostgreSQL Syntax
As default Setting, SQL syntax on PostgreSQL need quotes character (”") to recognize table name and field name (just like oracle i think -> CMIIMW). Here is the example of select syntax on postgreSQL and executed by PHP.

Those are simple and standart examples of executing SQL syntax on PostgreSQL using PHP. Those rules also implemented for another postgreSQL syntax. And here some default SQL execution syntax functions on PHP for postgreSQL that often used:
- pg_query($SQLString)
- pg_num_rows($SQLQuery)
- pg_fetch_array($SQLQuery)
- etc (read on pnp manual for more he he…http://www.php.net)
Here is the example of showing a data on html table:

Ok I think that’s it, all the first step you need to know to make you able to work with PHP and PostGreSQL. You can improvise your PHP and PostgreSQL integration to get more advance experience.
(OOT: you know dude, for me, an outstanding effort was needed to write all of this in English…..thank God it finally done) for someone that give me an advice to write in English…u can consider it done…..he he he
W$ wr wb