470,593 Members | 2,402 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,593 developers. It's quick & easy.

select and produce row from empty table

Based upon an article I read in
http://archives.neohapsis.com/archiv...4-q1/0337.html I am
trying to retrieve an "empty row" of fields from a table that may be
empty.

If I have this query:

SELECT id, fname, mi, lname FROM folks LIMIT 1
This will return 1 single row whereby I have the table columns within
an object resultset I can manipulate in PHP. However, if the table is
empty I have nothing and there is not object for PHP to manipulate,
which is required for the code I'm building (I'm doing a logical join
between database metadata and objects in a directory that may/may not
sync).

How would I then write my query to always produce 1 row consisting of
all fields I need even if the table is empty?

Thanx
Phil
Jul 19 '05 #1
3 3117
On 7 Apr 2004 08:45:38 -0700, in mailing.database.mysql
so*****@erols.com (Phil Powell) wrote:
| Based upon an article I read in
| http://archives.neohapsis.com/archiv...4-q1/0337.html I am
| trying to retrieve an "empty row" of fields from a table that may be
| empty.
|
| If I have this query:
|
|
>| SELECT id, fname, mi, lname FROM folks LIMIT 1
|
| This will return 1 single row whereby I have the table columns within
| an object resultset I can manipulate in PHP. However, if the table is
| empty I have nothing and there is not object for PHP to manipulate,
| which is required for the code I'm building (I'm doing a logical join
| between database metadata and objects in a directory that may/may not
| sync).
|
| How would I then write my query to always produce 1 row consisting of
| all fields I need even if the table is empty?


initialise page variables
read record
if not eof
place records into page variables

---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #2
On 7 Apr 2004 08:45:38 -0700, in mailing.database.mysql
so*****@erols.com (Phil Powell) wrote:
| Based upon an article I read in
| http://archives.neohapsis.com/archiv...4-q1/0337.html I am
| trying to retrieve an "empty row" of fields from a table that may be
| empty.
|
| If I have this query:
|
|
>| SELECT id, fname, mi, lname FROM folks LIMIT 1
|
| This will return 1 single row whereby I have the table columns within
| an object resultset I can manipulate in PHP. However, if the table is
| empty I have nothing and there is not object for PHP to manipulate,
| which is required for the code I'm building (I'm doing a logical join
| between database metadata and objects in a directory that may/may not
| sync).
|
| How would I then write my query to always produce 1 row consisting of
| all fields I need even if the table is empty?


initialise page variables
read record
if not eof
place records into page variables

---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #3
On 7 Apr 2004 08:45:38 -0700, in mailing.database.mysql
so*****@erols.com (Phil Powell) wrote:
| Based upon an article I read in
| http://archives.neohapsis.com/archiv...4-q1/0337.html I am
| trying to retrieve an "empty row" of fields from a table that may be
| empty.
|
| If I have this query:
|
|
>| SELECT id, fname, mi, lname FROM folks LIMIT 1
|
| This will return 1 single row whereby I have the table columns within
| an object resultset I can manipulate in PHP. However, if the table is
| empty I have nothing and there is not object for PHP to manipulate,
| which is required for the code I'm building (I'm doing a logical join
| between database metadata and objects in a directory that may/may not
| sync).
|
| How would I then write my query to always produce 1 row consisting of
| all fields I need even if the table is empty?


initialise page variables
read record
if not eof
place records into page variables

---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Newbie | last post: by
reply views Thread by Phil Powell | last post: by
3 posts views Thread by Ian T | last post: by
4 posts views Thread by jimh | last post: by
4 posts views Thread by psql-mail | last post: by
7 posts views Thread by Milos Prudek | last post: by
reply views Thread by DutchD | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.