GetAssoc() ADODB Question:

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

GetAssoc() ADODB Question:

Post by neophyte »

I'm using GetAssoc() to return data. This is how it is currently returning:

Code: Select all

ї178]=> //THIS IS THE PROBLEM
  array(11) {
    ї&quote;id&quote;]=>
    string(3) &quote;178&quote;
    ї0]=>
    string(29) &quote;Aesthetics and Visual Culture&quote;
    ї&quote;res_name&quote;]=>
    string(29) &quote;Aesthetics and Visual Culture&quote;
    ї1]=>
    string(45) &quote;http://pegasus.cc.ucf.edu/~janzb/aesthetics/
&quote;
    ї&quote;res_url&quote;]=>
    string(45) &quote;http://pegasus.cc.ucf.edu/~janzb/aesthetics/
&quote;
    ї2]=>
    string(7) &quote;8388607&quote;
    ї&quote;res_time&quote;]=>
    string(7) &quote;8388607&quote;
    ї3]=>
    string(3) &quote;178&quote;
    ї&quote;resource_id&quote;]=>
    string(3) &quote;178&quote;
    ї4]=>
    string(1) &quote;5&quote;
    ї&quote;category_id&quote;]=>
    string(1) &quote;5&quote;
  }
As you can see the index starts at 178. Is there a way to force GetAssoc() to start at 0 instead of using the first column of the db to order the array?

Here's the code I'm currently using.

Code: Select all

$resource = $db -> GetAssoc($sql);
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

if there is no FLAG in the manual, you better just write your own function to reindex it, even though I don't see why, you rarely use the index anyway?
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Thanks for the tip... I didnt' see anything in the manual either.
Post Reply