Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP6
|
BOOK: Professional PHP6
This is the forum to discuss the Wrox book Professional PHP6 by Edward Lecky-Thompson, Steven Nowicki; ISBN: 9780470395097
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 23rd, 2010, 07:59 PM
Authorized User
 
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
Default Connection with PostgreSQL

Hello (sorry for the english but i'm italian)
I've some problem with the connection with a database of PostgreSQL because i don't know the correct syntax, i try this code:
Code:
<?php
$db = pg_pconnect("host=localhost port=5432 dbname=postgres user=postgres password=pass");

$sql = 'CREATE TABLE "widget" (
	"widgetid" SERIAL PRIMARY KEY NOT NULL,
	"name" varchar(255) NOT NULL,
	"description" text
	)';
	
pg_query($db, $sql) or die ("unable to create table");

echo 'success';
?>
The result is an HTTP Error 500, php and apache are correctly configured, i can try all the php functions, but i don't know the correct configuration php-postgresql. With a phpinfo i see a field named "mysqlnd", but i've only install postgresql and never mysql or others.. can you help me please? Thanks a lot.
 
Old April 1st, 2011, 12:25 AM
Registered User
 
Join Date: Mar 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Smile user: postgresm , password:pass can Permissions to CREATE TABLE

1: make sure your user: postgresm AND password:pass
can Permissions to CREATE TABLE

2:you can write one.php to link database can sure is good
and then to write two.php to write somethig from database

and three.php to insert data into database

you can Step by step to win





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with change postgreSQL connection to MySQL chadneiro PHP How-To 2 July 7th, 2010 12:37 PM
Postgresql Transactions satyr Pro JSP 0 March 23rd, 2006 08:31 AM
question regarding PostgreSQL Moharo MySQL 2 September 9th, 2003 02:38 AM
Upgrading Postgresql 7.1.3 to 7.3.3 ganesh15 PHP How-To 1 September 3rd, 2003 11:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.