php insert problem

php insert problem

am 22.05.2002 17:06:23 von dan radom



$database = pg_connect ("host=localhost dbname=rbak user=nobody") or die("database connection failed");
$result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')";

if (!$result) {
echo "query died\n";
exit;
}



the above code produces a parse error. "parse error, unexpected ';' in blah.php on line X"

line X is the $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')"; line. I've started at this long enough, and it's time for other eyes to look. any ideas? similar SELECT queries work just fine.

dan

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Re: php insert problem

am 22.05.2002 17:33:05 von Chadwick Rolfs

You need to close your parenthesis after the last double quote.

On Wed, 22 May 2002, dan radom wrote:

>
>
> $database = pg_connect ("host=localhost dbname=rbak user=nobody") or die("database connection failed");
> $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')";
>
> if (!$result) {
> echo "query died\n";
> exit;
> }
>
>

>
> the above code produces a parse error. "parse error, unexpected ';' in blah.php on line X"
>
> line X is the $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')"; line. I've started at this long enough, and it's time for other eyes to look. any ideas? similar SELECT queries work just fine.
>
> dan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

-Chadwick


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Re: php insert problem

am 22.05.2002 17:35:32 von Surojit Niyogi

Hi Dan,

You're missing a close parentheses ")" in the pg_exec line... :)

Roj Niyogi
pgHoster.com
PostgreSQL web hosting

dan radom wrote:

>
>
> $database = pg_connect ("host=localhost dbname=rbak user=nobody") or die("database connection failed");
> $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')";
>
> if (!$result) {
> echo "query died\n";
> exit;
> }
>
>

>
>the above code produces a parse error. "parse error, unexpected ';' in blah.php on line X"
>
>line X is the $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')"; line. I've started at this long enough, and it's time for other eyes to look. any ideas? similar SELECT queries work just fine.
>
>dan
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>
>



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: php insert problem

am 22.05.2002 17:41:15 von Chris Thompson

Should it not be

$result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email');");

Cheers

On Wed, 22 May 2002, dan radom wrote:

>
>
> $database = pg_connect ("host=localhost dbname=rbak user=nobody") or die("database connection failed");
> $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')";
>
> if (!$result) {
> echo "query died\n";
> exit;
> }
>
>

>
> the above code produces a parse error. "parse error, unexpected ';' in blah.php on line X"
>
> line X is the $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')"; line. I've started at this long enough, and it's time for other eyes to look. any ideas? similar SELECT queries work just fine.
>
> dan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
> --
> Virus scanned by edNET.
>

--

This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender. Any
offers or quotation of service are subject to formal specification.
Errors and omissions excepted. Please note that any views or opinions
presented in this email are solely those of the author and do not
necessarily represent those of edNET or lightershade ltd. Finally, the
recipient should check this email and any attachments for the presence of
viruses. edNET and lightershade ltd accepts no liability for any damage
caused by any virus transmitted by this email.

--
--
Virus scanned by edNET.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Re: php insert problem

am 22.05.2002 17:45:28 von Peter

You're missing a closing )

$result = pg_exec ($database, "INSERT into employees (emp_name, emp_email)
VALUES ('$emp_name','$emp_email')");


Peter

----- Original Message -----
From: "dan radom"
To:
Sent: Wednesday, May 22, 2002 4:06 PM
Subject: [PHP] php insert problem


>
>
> $database = pg_connect ("host=localhost dbname=rbak user=nobody") or
die("database connection failed");
> $result = pg_exec ($database, "INSERT into employees (emp_name,
emp_email) VALUES ('$emp_name','$emp_email')";
>
> if (!$result) {
> echo "query died\n";
> exit;
> }
>
>

>
> the above code produces a parse error. "parse error, unexpected ';' in
blah.php on line X"
>
> line X is the $result = pg_exec ($database, "INSERT into employees
(emp_name, emp_email) VALUES ('$emp_name','$emp_email')"; line. I've
started at this long enough, and it's time for other eyes to look. any
ideas? similar SELECT queries work just fine.
>
> dan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
>



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Re: php insert problem

am 22.05.2002 17:46:42 von Matteo Beccati

Hi,

It seems you forgot closing the php function arguments with ')':

$result = pg_exec ($database, "INSERT into employees
(emp_name, emp_email) VALUES ('$emp_name','$emp_email')");

This should work

Regards
--
Matteo Beccati
http://www.phpadsnew.com
http://phppgads.sourceforge.net


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Re: php insert problem

am 22.05.2002 18:53:01 von Chadwick Rolfs

Hey, dan... are you getting these messages? It seems we have a consensus.
Do you still get an error?

On Wed, 22 May 2002, Chris Thompson wrote:

> Should it not be
>
> $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email');");
>
> Cheers
>
> On Wed, 22 May 2002, dan radom wrote:
>
> >
> >
> > $database = pg_connect ("host=localhost dbname=rbak user=nobody") or die("database connection failed");
> > $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')";
> >
> > if (!$result) {
> > echo "query died\n";
> > exit;
> > }
> >
> >

> >
> > the above code produces a parse error. "parse error, unexpected ';' in blah.php on line X"
> >
> > line X is the $result = pg_exec ($database, "INSERT into employees (emp_name, emp_email) VALUES ('$emp_name','$emp_email')"; line. I've started at this long enough, and it's time for other eyes to look. any ideas? similar SELECT queries work just fine.
> >
> > dan
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> > --
> > Virus scanned by edNET.
> >
>
> --
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify the sender. Any
> offers or quotation of service are subject to formal specification.
> Errors and omissions excepted. Please note that any views or opinions
> presented in this email are solely those of the author and do not
> necessarily represent those of edNET or lightershade ltd. Finally, the
> recipient should check this email and any attachments for the presence of
> viruses. edNET and lightershade ltd accepts no liability for any damage
> caused by any virus transmitted by this email.
>
> --
> --
> Virus scanned by edNET.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

-Chadwick


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org