Looking for help

Looking for help

am 28.08.2002 00:56:07 von Joseph L Montes

I am new to combining PHP and Postgres. I am able to Select and create
tables by using the Select * From "table" command fine, but What happens
if I only want to select a couple of fields. How do I go about this.
also how do you select from a table that is not all lower case. Granted
this is probably quite simple, but I am new to this. thanks ewveryone
--
Joseph L Montes
Senior Systems Engineer
Zenplex Inc.
317 Madison Ave. suite 1500
New York New York
V(212)499-0668 Ext. 203
F(646)865-0783
http://www.zenplex.com
http://www.zenplex.org
http://www.tambora.org


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

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

Re: Looking for help

am 28.08.2002 01:05:52 von Patrick Hatcher

Use quotes around the field and table names that are not all lower case:

Ex:
$result = pg_query($db," Select 'Field1',field2, 'fEild3' From'TABLE1' ");



Patrick Hatcher





Joseph L Montes
> cc:
Sent by: Subject: [PHP] Looking for help
pgsql-php-owner@post
gresql.org


08/27/2002 03:56 PM





I am new to combining PHP and Postgres. I am able to Select and create
tables by using the Select * From "table" command fine, but What happens
if I only want to select a couple of fields. How do I go about this.
also how do you select from a table that is not all lower case. Granted
this is probably quite simple, but I am new to this. thanks ewveryone
--
Joseph L Montes
Senior Systems Engineer
Zenplex Inc.
317 Madison Ave. suite 1500
New York New York
V(212)499-0668 Ext. 203
F(646)865-0783
http://www.zenplex.com
http://www.zenplex.org
http://www.tambora.org


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

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




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

http://archives.postgresql.org

Re: Looking for help

am 28.08.2002 01:20:42 von Cornelia Boenigk

Hi Joseph

> but What happens
> if I only want to select a couple of fields.
Then you tell the server which fields you want to select;-)

SELECT field1, field2, ... , fieldn FROM table ...

> how do you select from a table that is not all lower case
what do you mean? what is not all lower case?
PostgreSQL returns the contents of the fields as they are. If you need
the results to be in lower case use
SELECT lower(fieldx), lower(field2),... FROM table
respectively
SELECT upper(field1), upper(field2), ... FROM table.

See chapter 4.4 of the PostgreSQL user's Guide for more.

The PHP-Functions to change case are strtoupper() and strtolower().

Hope it helps

Regards
Conni


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

Re: Looking for help

am 28.08.2002 02:06:14 von pgerzson

2002. augusztus 28. 01:05 dátummal Patrick Hatcher ezt írta:
> Use quotes around the field and table names that are not all lower
> case:
>
> Ex:
> $result = pg_query($db," Select 'Field1',field2, 'fEild3'
> From'TABLE1' ");
>

AFAIK, opstgres needs double quotes to handle objects' names literally
-- as written:

$result = pg_query($db,' Select "Field1",field2, "fiEld3"
From "TABLE1"');

text within simple quotes represents string literals.

--
Papp, Gyõzõ
- pgerzson@freestart.hu


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: Looking for help

am 28.08.2002 03:38:01 von Keary Suska

on 8/27/02 4:56 PM, jmontes@zenplex.com purportedly said:

> also how do you select from a table that is not all lower case. Granted
> this is probably quite simple, but I am new to this. thanks ewveryone

Table and column names are not case-sensitive in Postgres.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"


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