Re: unable to insert row with php+pgsql

From: Date: Mon, 20 May 2002 20:07:42 +0000
Subject: Re: unable to insert row with php+pgsql
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19296@lists.php.net to get a copy of this message
"Ktt" <kestutis98@yahoo.com> wrote in message news:20020520170236.82012.qmail@web13901.mail.yahoo.com... > 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? Yes, it is a configuration problem... The default for register_globals has changed latetly... Try using the recommended new way. ${_GET["firstname"]} and ${_GET["surname"]} instead. > <? > 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(); > ?>

« previous php.db (#19296) next »