Thread: sql commands

sql commands

From
"P. Jourdan"
Date:
I am trying to debug a pg database that was set up under pg 7.0.3 and am
now trying to run it for testing on a local FreeBSD machine under pgsql
7.2.1_1 and php4.1.2 module and apache1.3 something. All is set up
correctly, but the rebuilt database is giving some problems.
I note that there are sql commands in the php files: sqlconnect, sqlget,
select - I don't quite understand how these commands fit in with php. Has
something changed in the newer version of php4?
I do not find any reference to the sql commands in the handbook.
I would much appreciate some help on this as I am quite new to php.
Philip Jourdan


Re: sql commands

From
"Rod Taylor"
Date:
sqlconnect / sqlget, etc. must be an extension that the original
author used.  It's not standard with php, but is a good idea.

I'm guessing the SELECT is an sql statement, not a function correct?

What are the errors returned by the script when it runs?
--
Rod
----- Original Message -----
From: "P. Jourdan" <pippo@videotron.ca>
To: <pgsql-php@postgresql.org>
Sent: Wednesday, May 01, 2002 12:08 PM
Subject: [PHP] sql commands


> I am trying to debug a pg database that was set up under pg 7.0.3
and am
> now trying to run it for testing on a local FreeBSD machine under
pgsql
> 7.2.1_1 and php4.1.2 module and apache1.3 something. All is set up
> correctly, but the rebuilt database is giving some problems.
> I note that there are sql commands in the php files: sqlconnect,
sqlget,
> select - I don't quite understand how these commands fit in with
php. Has
> something changed in the newer version of php4?
> I do not find any reference to the sql commands in the handbook.
> I would much appreciate some help on this as I am quite new to php.
> Philip Jourdan
>
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
>


Re: sql commands

From
"P. Jourdan"
Date:
At 12:37 PM 5/1/2002 -0400, you wrote:
>sqlconnect / sqlget, etc. must be an extension that the original
>author used.  It's not standard with php, but is a good idea.
>
>I'm guessing the SELECT is an sql statement, not a function correct?

yes


>What are the errors returned by the script when it runs?
I just accessed the local site & I get the following:

ERROR: Relation 'visits'does not have attribute 'path'
ERROR: Bad boolean external representation '<font
color=red><b>YES></b></font>'
ERROR: Relation "mustdie" does not exist
NOTICE: Adding missing FROM-clause entry for table "customer"
ERROR: No such atribute or function 'pcustomer_id'
I believe I understand that some fields or columns are missing as well as
variables or other elements... but what is strange, is that this happens
only in the administrative end and not on the site pages.
I can send a snippet of the php file or the whole file, for that matter.
They are not very big.
I have also gotten this:
FATAL 1: Database :"template0" is not currently accepting connections
I do not understand what is the use of the "template0" - is it the base
"model" for newly created databases? I was under the impression that that
was template1...
Thanks for your help
Philip


Re: sql commands

From
"Rod Taylor"
Date:
> >What are the errors returned by the script when it runs?
> I just accessed the local site & I get the following:
>
> ERROR: Relation 'visits'does not have attribute 'path'
> ERROR: Bad boolean external representation '<font
> color=red><b>YES></b></font>'
> ERROR: Relation "mustdie" does not exist
> NOTICE: Adding missing FROM-clause entry for table "customer"
> ERROR: No such atribute or function 'pcustomer_id'
> I believe I understand that some fields or columns are missing as
well as
> variables or other elements... but what is strange, is that this
happens
> only in the administrative end and not on the site pages.
> I can send a snippet of the php file or the whole file, for that
matter.
> They are not very big.

Yes, it's quite obvious that you are missing some of the columns /
relations the code expects.  The reason it works on the client side is
probably that the columns / relations are not being used in it.  I'd
need more than just the php code.  It interacts with the database.
I'll need a dump of it as well.

Please send directly, not to the list.

> I have also gotten this:
> FATAL 1: Database :"template0" is not currently accepting
connections
> I do not understand what is the use of the "template0" - is it the
base
> "model" for newly created databases? I was under the impression that
that
> was template1...

template0 is like an emergency backup to template1.  Template1 can be
mucked with.  If you want it back to original you drop it and recreate
it with template0.  There is no reason you should be connecting to it.


Re: sql commands

From
"Rod Taylor"
Date:
[cross posting to pgadmin-hackers]

That makes sense, except pgAdmin shouldn't try to connect to a
database marked that it doesn't accept connections.
--
Rod
----- Original Message -----
From: "P. Jourdan" <pippo@videotron.ca>
To: "Rod Taylor" <rbt@zort.ca>
Cc: <pgsql-php@postgresql.org>
Sent: Thursday, May 02, 2002 11:53 AM
Subject: Re: [PHP] sql commands


> At 01:03 PM 5/1/2002 -0400, Rod Taylor wrote:
>
> >template0 is like an emergency backup to template1.  Template1 can
be
> >mucked with.  If you want it back to original you drop it and
recreate
> >it with template0.  There is no reason you should be connecting to
it.
>
> It seems that the error message I was getting for the template0 is a
> pgAdmin2 problem - pgAdmin2 accesses all the databases and thus
generates
> the error code.
> Phil Jourdan
>
>


Re: sql commands

From
"P. Jourdan"
Date:
At 01:03 PM 5/1/2002 -0400, Rod Taylor wrote:

>template0 is like an emergency backup to template1.  Template1 can be
>mucked with.  If you want it back to original you drop it and recreate
>it with template0.  There is no reason you should be connecting to it.

It seems that the error message I was getting for the template0 is a
pgAdmin2 problem - pgAdmin2 accesses all the databases and thus generates
the error code.
Phil Jourdan