#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    1
    Rep Power
    0

    Red face Creating PostgreSQL table


    I am attemtping to create a table in my database through a FTP client using Pearl Script. The following is a copy of my script. I saved the file as a text file and placed it in my cgi local directory.



    $db=pg_connect("dbname=mydb user=mydb");

    SQL-query:

    CREATE TABLE members (
    id int(11) NOT NULL auto_increment,
    fname varchar(25),
    lname varchar(25) NOT NULL,
    address varchar(100) NOT NULL,
    city varchar(25) NOT NULL,
    state varchar(25) NOT NULL,
    zip int(5) DEFAULT '0' NOT NULL,
    phone varchar(15),
    )



    This script reults in a Premature end of script headers: error. Can anyone tell me how to fix my code.
  2. #2
  3. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    30
    One thing that I noticed is that in SQL statements you use commas to seperate a series of items. You don't put a comma after the last item. Your query has a comma after the last field which should be removed.

    This:

    phone varchar(15),)

    Should be:

    phone varchar(15))

IMN logo majestic logo threadwatch logo seochat tools logo