logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Multiple records Retrieval in MySQL

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
rpgbl



Joined: 01 Oct 2009
Posts: 30

PostPosted: Thu Oct 01, 2009 3:50    Post subject: Multiple records Retrieval in MySQL Reply with quote

Hi guys,

I've got a bit of a problem. I have 5 records and each records has attributes (name, score, location etc). When I create a query SELECT * from mytablescore, the result only shows the first record. Anybody can help please? Thanks.


note : im using NWNX + MySQL by Ingmar Stieger
Back to top
View user's profile Send private message
Themicles



Joined: 23 Jan 2005
Posts: 30
Location: Wolverine Lake, MI

PostPosted: Fri Oct 02, 2009 5:01    Post subject: Reply with quote

I do believe you have to iterate through the results with script commands. It's been years since I last wrote a script that had to do this, so details may have to wait until I have time to open up some old scripts.
_________________
World Leader of Tairis'nądur http://www.tairisnadur.com
Member World of CoPaP http://www.copap.org
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Themicles



Joined: 23 Jan 2005
Posts: 30
Location: Wolverine Lake, MI

PostPosted: Fri Oct 02, 2009 5:09    Post subject: Reply with quote

I decided I had time right now, so went and looked it up.

Looking at my old scripts, it looks like I'm using a while loop:
Code:
while(SQLFetch() == SQL_SUCCESS)


I'll be honest, it's been so long since I wrote the system I'm quoting from that I don't really understand what I'm looking at anymore. Embarassed

Looking at aps_include, this is the definition of the command:
Code:
// Position cursor on next row of the resultset
// Call this before using SQLGetData().
// returns: SQL_SUCCESS if there is a row
//          SQL_ERROR if there are no more rows
int SQLFetch();

_________________
World Leader of Tairis'nądur http://www.tairisnadur.com
Member World of CoPaP http://www.copap.org
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group