This site will work and look better in a browser that supports
web standards, but it should be accessible for any browser or Internet device.
If you're seeing this message, you may have to scroll to the bottom of the page to see the navigation links.
PHP and PostgreSQL Links and Notes
This is a collection of notes and links that we find useful with PHP.
PHP - Notes
What's My Name? -- you can find out the name of the current document by calling $PHP_SELF. If you're using Apache with PHP under Windows, you'll need to eliminate the path to PHP itself from this:
$PHP_SELF = str_replace($SCRIPT_NAME, "", $PHP_SELF);
What does the error 'Warning: 1 is not a valid PostgreSQL-Link resource' mean?: It can mean one of several things. One, that the postmaster isn't running. Check this by doing this:
ps aux | grep post
One of the items --perhaps the only one-- should be postmaster
Under PHP4, another possibility is that sometimes it doesn't like the name of the variable you're using to do the connecting. Under PHP3, I used: $conn = pg_connect("", "", "", "my_database"). PHP4 doesn't seem to like $conn or it doesn't like the same variable name showing up for different connections. So, change $conn to something else (make sure you're consistant throughout the connection). This bug has been documented on the developer list, so it will probably disappear with Patch Level 3 or 4.
A third possibility --and a cause of many blow-ups in php database connections for me-- is that you try to connect or disconnect multiple times to the database. Loops in particular can cause problems here (e.g. you're looping through a list of things to be added).
I'm getting weird errors with my code and it should be working -- First, try moving part or all of your code about the first html (e.g. the tag). A lot of times this will solve that problem
I'm getting weird errors with my SQL Code (PHP 4) -- Make sure that you don't have it trying to reconnect when there's an existing connection. It'll change the value in the variable you use to track the connection with creating a new connection. Not good.
PHP - General
PHP - Setup/Installation
PHP User Group Resource List is a regularly updated list of how-to's and faqs related to PHP. Good and extensive.
Covers both PHP and PHP with SQL Databases
Zend articles on PHP. This includes specific articles on Sessions under PHP 4 and Free Energy (how to use includes, etc., to grab items used repeatedly from a central place) and Reference Counting and Aliasing. Zend seems to be the driving force between the addition of Sessions and other critical ecommerce capabilities to PHP. Die proprietary software, die, eh?
Official PostgreSQL Documents:
Guide (intoduction and list of related tools)
Installation and Setup
Linux Focus SQL Tutorial
If you get the error "RestrictionClauseSelectivity: bad value ", Do VACUUM ANALYZE on the table. Usually this means a value in a column that you're querying has gotten messed up. If that doesn't work, try Alter table X rename to Y and then rename it back. The real solution is supposed to be to update to Postgres 6.5 or later.