Re: psql with PHP question

Поиск
Список
Период
Сортировка
От Gyozo Papp
Тема Re: psql with PHP question
Дата
Msg-id 011301c0d3ec$cd91c940$5145c5d5@jaguar
обсуждение исходный текст
Ответ на psql with PHP question  (Jason <gee308@mediaone.net>)
Ответы Re: psql with PHP question  (Joel Burton <jburton@scw.org>)
Re: psql with PHP question  (Jesus Aneiros <aneiros@ucfinfo.ucf.edu.cu>)
Re: psql with PHP question  (Joel Burton <jburton@scw.org>)
Re: psql with PHP question  (Jesus Aneiros <aneiros@ucfinfo.ucf.edu.cu>)
Список pgsql-php
In my opinion, these queries make the same :
SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
SELECT MAX(id) FROM article;

but the latter one is much more simple and you do not overload your pg.
(by the way, I think id = (SELECT ...) isn't handled gracefully.)

----- Original Message -----
From: "Jason" <gee308@mediaone.net>
To: <pgsql-php@postgresql.org>
Cc: <pgsql-novice@postgresql.org>; <pgsql-general@postgresql.org>
Sent: 2001. május 3. 14:06
Subject: [PHP] psql with PHP question


> Hi, I want to try  and optimize my calls to postgreSQL from PHP.  If
> I only need one field from a select statement, what should I use?  I am
> currently using:
> $q = pg_Exec("SELECT id FROM article WHERE id=(SELECT MAX(id)
> FROM article)");
> $maxid = pg_fetch_array($q, 0);
> echo "The highest id is ". $maxid[0];
> What can I use besides an array to get a single value? In general, using
> a single variable always saves more memory than using an array?  Thank
> you.
> Jason
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


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




В списке pgsql-php по дате отправления:

Предыдущее
От: Philip Hallstrom
Дата:
Сообщение: Re: psql with PHP question
Следующее
От: Joel Burton
Дата:
Сообщение: Re: psql with PHP question