Re: psql with PHP question
От | Adam Lang |
---|---|
Тема | Re: psql with PHP question |
Дата | |
Msg-id | 008b01c0d3d1$bfe11a00$330a0a0a@rutgersinsurance.com обсуждение исходный текст |
Ответ на | psql with PHP question (Jason <gee308@mediaone.net>) |
Список | pgsql-php |
First off, cross-posting is rude. Don't post to more than one list at a time. Post your question to the most relevant list first and if you don't get help, then try another one. As for your select statement, why do you have the select around the other select? Why don't you just have this: SELECT MAX(id) FROM article As for how the result is returned, not much you can do about it. That is the way PHP is. As a matter of fact, that is the way a vast majority of database interaction programs are. They send an array so that the field name can accompany it. Only optimization you can do is fix the select statement. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Jason" <gee308@mediaone.net> To: <pgsql-php@postgresql.org> Cc: <pgsql-novice@postgresql.org>; <pgsql-general@postgresql.org> Sent: Thursday, May 03, 2001 8:06 AM 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
В списке pgsql-php по дате отправления: