Skip site navigation (1) Skip section navigation (2)

Re: PHP form Creates Blank DB entries

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: PHP form Creates Blank DB entries
Date: 2003-06-30 17:23:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-php
At 12:16 PM 6/30/03, Michael Hanna wrote:
>// error checks on form submission go here
>// generate and execute a query
>$query = "INSERT INTO addressbook VALUES (nextval('addressbook_id_seq'), 
>'$name', '$address', '$tel', '$email')";
>$result = pg_query($connection, $query)
>         or die("Error in query: $query. " . pg_last_error($connection));
>echo "Data successfully added.";
>// close database connection
>pg_close($connection); } ?>

Probably because "register globals" is off (default changed since 4.2.0).

Insert the following lines before "$query = ..." line:

$name = $_POST[name];
$address = $_POST[address];
$tel = $_POST[tel];
$email = $_POST[email];

In response to


pgsql-php by date

Next:From: Michael HannaDate: 2003-06-30 19:54:22
Subject: Best way to convert PG's TIMESTAMPTZ to PHP DATE?
Previous:From: Michael HannaDate: 2003-06-30 16:16:46
Subject: PHP form Creates Blank DB entries

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group