Wednesday, September 24, 2014

PHP - Connecting to PSQL from PHP

Quick post on how to connect to PSQL from PHP, run queries, and retrieve results. You can use the same syntax for inserts, updates and other statements.

linux-test# vim test.php

Tuesday, September 23, 2014

PHP - Reading a file into an array

Quick post on how to read a file into an array. As always there are more than one way to do this.

First create a test.txt file with some lines in it.

linux-test# echo 1st line >> test.txt
linux-test# echo 2nd line >> test.txt
linux-test# echo 3rd line >> test.txt
linux-test# echo 4th line >> test.txt