Jump to content

Using ADODB with PHP, not calling columns in correct order messes up results.


iarp

Recommended Posts

Hey there, i have a stored procedure that passes me information from the techs database.

 

I'm stuck using some type of ADODB system, I've never used it in the past. But i'm finding, if i have 50 columns and i call column 29 and then try to call on column 15 (using their names not the number) column 15 comes through as blank.

 

But if i call column 15 and then 29 everything works.

 

Not sure how to do this, i cannot modify the Stored Procedure to my column ordering on the web page, and i have a lot of columns. At first i thought of maybe putting the data in the order of the SP's results into variables and then using the variables as i see fit, just there's a lot of columns i'm pulling.

Link to comment
Share on other sites

$teams = $db->Execute("EXEC Sports.dbo.TeamMembers");

while(!$teams->EOF) {
    echo $teams->Fields['RdPk'];
    echo $teams->Fields['Position'];
    echo $teams->Fields['Bchk'];
    echo $teams->Fields['Rating'];
    $teams->MoveNext();
}
$teams->Close();

 

Mind you that is a small list of columns. But the SP returns it in this order

 

1. Position

2. RdPk

3. Rating

4. Bchk

Link to comment
Share on other sites

I run the exact same SP within the database itself and all data is correct, all data is present and everything has information, every cell.

 

But within the $teams->Fields entries, they are empty depending on what order i call them in.

 

This is a paste of the columns i have to deal with. There are many others, another SP i'm calling from has many many more columns.

 

PlayerIds
LeagueName
DivisionName
SubDivisionName
SeasonName
DraftListrOUNDNumber
DraftListPickNumber
RndPck
DraftStartPosition
Team
LastName
FirstName
HCId
SMId
Season
League
Division
PlayerAvailable
PlayerType
BChk
DOBY
DateOfBirth
FullName
Avl
PlayerType
MF
Rank
Rating
Goals
Assists
Shoots
Position

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.