Changed the query and get this error when input dave as firstname: ERRORERROR: Attribute 'dave' not found
add2.php is: <html> <body> <?php $db = pg_connect("dbname=friends"); $query = "INSERT INTO friends (id, firstname, surname) values (nextval('friends_id_seq'), ".$_POST['firstname'].", ".$_POST['surname'].")"; $result = pg_exec($db, $query); if (!$result) { printf ("ERROR"); $errormessage = pg_errormessage($db); echo $errormessage; exit; } printf ("These values were inserted into the database - %s %s", $firstname, $surname); pg_close(); ?> </body> </html> addform.php is: <html> <body> <form action="add2.php" method="post"> First Name : <input type="text" name="firstname" size="40" length="40" value=""><BR> Surname : <input type="text" name="surname" size="40" length="40" value=""><BR> <input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Clear It"> </form> </body> </html> On Sat, 1 Jun 2002 17:44:57 +0100 [EMAIL PROTECTED] (Stuart Dallas) wrote: > On Saturday, June 1, 2002 at 5:35:03 PM, you wrote: > > Is there anything I should do to make the php.ini come into effect? I did > > put the register_global = On but still got empty values. > > you may not need to do anything or you may need to restart your http server. > Have a look at your phpinfo() page. If it's picking up the php.ini file then it > will show it's filename as well as it's path. > > > <?php > > $db = pg_connect("dbname=friends"); > > $query = "INSERT INTO friends (id, firstname, surname) values >(nextval('friends_id_seq'), $_POST['firstname'], $_POST['surname'])"; > > $result = pg_exec($db, $query); > > if (!$result) { > > printf ("ERROR"); > > $errormessage = pg_errormessage($db); > > echo $errormessage; > > exit; > > } > > printf ("These values were inserted into the database - %s %s", $firstname, >$surname); > > pg_close(); > ?>> > > </body> > > </html> > > Hmm, line 6 of that code would be printf ("ERROR"); but I'll assume that you > haven't included the first few lines and that line 6 is actually the pg_exec > line. You haven't changed $query as I suggested in a previous message. Change > the $query = line to the following... > > $query = "INSERT INTO friends (id, firstname, surname) values > (nextval('friends_id_seq'), ".$_POST['firstname'].", ".$_POST['surname'].")"; > > -- > Stuart > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php