473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 3269
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: Phil Powell | last post by:
Based upon an article I read in http://archives.neohapsis.com/archives/mysql/2004-q1/0337.html I am trying to retrieve an "empty row" of fields from a table that may be empty. If I have this...
3
by: Ian T | last post by:
Hi, I've got what I think (probably incorrectly) should be a simple SELECT : Two colums with data like col1 col2 1 50 1 51 2 50
5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
4
by: psql-mail | last post by:
I am running a SELECT to get all tuples within a given date range. This query is much slwoer than i expected - am i missing something? I have a table 'meta' with a column 'in_date' of type...
7
by: Milos Prudek | last post by:
I need to insert a value = max(value)+1, where max is a select limited by a 'where' clause. Like this: INSERT INTO table (idthread, idsection,txt) VALUES ( (SELECT max(idthread)+1 FROM table...
5
by: Silvio Matthes | last post by:
Hello, I'm new to the list and did not find a suitable answer to my question so here it is: I try to select the rows of a table where the content of a varchar-column is empty ('') and...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
0
by: DutchD | last post by:
Good day all, Access novice here and have been stuck for a few days on what would take me two seconds in vba, but isnt that always the pain, now I want it done this way! I have a table (Input...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.