unable to insert row with php+pgsql
| From: | ktt | Date: | Mon, 20 May 2002 17:02:36 +0000 |
| Subject: | unable to insert row with php+pgsql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19286@lists.php.net to get a copy of this message | ||
hello,
I have a strange problem - unable to insert data in to
postgresql table, the script inserts only empty rows.
(if i change variables $firstname and $surname to
strings, the script works.)
Maybe the problem in configuration of PHP?
<?
echo "<form action=\"pgsqltest01.php\"
method=\"get\">";
echo "First Name : <input type=\"text\"
name=\"firstname\" value=\"FirstName\">";
echo "<BR> Surname : <input type=\"text\"
name=\"surname\" value=\"Surname\">";
echo "<BR><input type=\"submit\" name=\"su\"
value=\"Submit\">";
echo " <input type=\"reset\" name=\"reset\"
value=\"Clear It\"></form>";
$db = pg_connect("dbname=friends user=postgres");
if ($su!='')
{
$query4 = "INSERT INTO friends (id, firstname,
surname) values (nextval('friends_id_seq'),
'$firstname', '$surname')";
$result = pg_exec($db, $query4);
}
pg_close();
?>
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com