I created this table:
   Column   |          Type                   | Modifiers
    ------------+------------------------+------------------------
   first_name | character varying(20)  |
  last_name  | character varying(30)  |
 w_number   | character varying(9)    |
      alert      | character varying(200) |
  post_date  | date                           |
       id         | integer                       | not null
Indexes:
    "alert_list_pkey" PRIMARY KEY, btree (id)
I get this error when I run the insert a listed below. The insert does not have 
an entry for the primary key "id" since I thought it updates automatically:
Warning: pg_query() 
[function.pg-query<http://finaid46.finaid.wwu.edu/lan/student_alerts/function.pg-query>]:
 Query failed: ERROR: null value in column "id" violates not-null constraint

$sql = "INSERT INTO alert_list (
                      w_number,
                      first_name,
                      last_name,
                      alert,
                      post_date
                  )
                  VALUES (
                      '$txtStudentNumber',
                      '$txtStudentFirstName',
                      '$txtStudentLastName',
                      '$txtStudentAlert',
                      'now()'
                  )";
How do I do an insert on this table and have the primary key "id" update with 
the record?

thanks

Marc

Reply via email to