Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
While through SQL query that doesnt have column names.
Old 12-22-2009, 06:41 AM While through SQL query that doesnt have column names.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Hi Guys,
Ive got a MASSIVE sql query that returns to columns, But doesnt actually have a colum name.

Normlaly i could use
while($row = mssql_fetch_array($result))
{
echo " Layer3Id " . $row["Layer3Id"];
echo " CustID " . $row["CustomerId"];
}

However
in this case i cant use the names..

How can i still achieve the same output without column identifiers?

IE:
currently it whines that theres undefined indexes ( because the column has no name )
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
 
Register now for full access!
Old 12-22-2009, 07:22 AM Re: While through SQL query that doesnt have column names.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It WILL have column names, even a "SELECT * FROM" returns with column names.

IF you know the order of the columns in the table you could use $row[numeric_index]; (zero based array index), but this will "break" should the table (s) be restructured at some time in the future.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-22-2009, 07:49 AM Re: While through SQL query that doesnt have column names.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Hi Thanks,

Ive found if i use, Select blaa from X AS Name ( inner join, convert etc etc etc ) as Otherthing

It works.

I forgot you could force column names

Ty for your help chris.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Reply     « Reply to While through SQL query that doesnt have column names.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41324 seconds with 12 queries