pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ktt <kestutis98@yahoo.com>
To: angelo.rigo@globo.com
Cc: pgsql-php@postgresql.org
Subject: Re: unable to insert rows with php
Date: Mon, 20 May 2002 05:04:18 -0700 (PDT)
Message-ID: <20020520120418.51354.qmail@web13902.mail.yahoo.com> (raw)
In-Reply-To: <3CD293640005CFA4@nplex.globo.com>

--- angelo.rigo@globo.com wrote:
> Can you show your code ?

yes. it's written for test.
------

<html><body>
<?php
$db = pg_connect("dbname=friends user=kes");
$query1 = "SELECT * FROM friends";
$result = pg_exec($db,$query1);
if (!$result) {printf ("ERROR");
exit;
}
$row = pg_fetch_row ($result,0);
printf ("ID : %s<br>\n", $row[0]);
printf ("First Name: %s<br>\n", $row[1]);
printf ("Surname : %s<br>\n", $row[2]);
$query3 = "INSERT INTO friends (id, firstname,
surname) values (nextval('friends_id_seq'),
'$firstname', '$surname')";
$result = pg_exec($db, $query3);
if (!$result) { printf ("ERROR");
$errormessage = pg_errormessage($db);
echo $errormessage;
exit;
}
pg_close();
printf ("These values were inserted into the database
- %s %s", $firstname, $surname);

echo"<form action=\"pgsqltest0.php\"
method=\"post\">";
echo "First Name : <input type=\"text\"
name=\"firstname\" size=\"40\" length=\"40\"
value=\"FirstName\">";
echo "<BR> Surname : <input type=\"text\"
name=\"surname\" size=\"40\" length=\"40\"
value=\"Surname\">";
echo "<BR><input type=\"submit\" name=\"submit\"
value=\"Submit\">";
echo " <input type=\"reset\" name=\"reset\"
value=\"Clear It\"></form> </body> </html>";

?>



> -- Mensagem Original --
> 
> >
> >Hello,
> >
> >I'm trying to insert data in the table, using PHP
> >interface, but script creates an empty
> >row without data.
> >If you had similar problem, please, suggest
> >a solution.
> >I'm using Debian potato, PostgreSQL 7.2,
> >Apache 1.3.24.
> >
> >Thank you in advance,
> >
> >ktt
> >
> >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >LAUNCH - Your Yahoo! Music Experience
> >http://launch.yahoo.com
> >
> >---------------------------(end of
> broadcast)---------------------------
> >TIP 2: you can get off all lists at once with the
> unregister command
> >    (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
> >
> 
> 
> 
> 
> ________________________________________
> A busca mais veloz e precisa da internet. Acesse
> agora: http://www.zoom.com.br.
> 


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



view thread (5+ messages)  latest in thread

Message-ID: <20020520120418.51354.qmail@web13902.mail.yahoo.com>
Permalink:  ../20020520120418.51354.qmail@web13902.mail.yahoo.com/
Also on:    postgresql.org/message-id/20020520120418.51354.qmail@web13902.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: kestutis98@yahoo.com, angelo.rigo@globo.com
  Subject: Re: unable to insert rows with php
  In-Reply-To: <20020520120418.51354.qmail@web13902.mail.yahoo.com>
  References: <3CD293640005CFA4@nplex.globo.com> <20020520120418.51354.qmail@web13902.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox