Calling the next row of the query

Started by D4rkR420R, May 02, 2018, 10:54 PM

Previous topic - Next topic

D4rkR420R

Hello lovely Vice City Multiplayer community! Today, I'm here to request some help from this piece of code I'm suffering. My question is why won't the loop not move to the next row when I've already implemented GetSQLNextRow?

Here's the code:
local a = 0, b = 0, q = QuerySQL( clan, "SELECT Player FROM Members" );
while( GetSQLColumnData( q, 0 ) )
{
local c1 = QuerySQL( clan, "SELECT Tag, Player FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 1 ) +"'" ), c2 = QuerySQL( clan, "SELECT Tag, Player FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 2 ) +"'" );
if( GetSQLColumnData( c1, 1 ) ) a++;
if( GetSQLColumnData( c2, 1 ) ) b++;
GetSQLNextRow( q );
}

Note that the first and second arguments are the clan tags specified. Hopefully you'll help me and provide feedback. Thank you.

Mahmoud Tornado

I don't know but did you try to add?

FreeSQLQuery(q);

umar4911

Try editing this and hope the problems solved. if not then tell me
q = QuerySQL( clan, "SELECT * FROM Members" );
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

D4rkR420R

Quote from: Mahmoud Tornado on May 03, 2018, 11:51 AMI don't know but did you try to add?

FreeSQLQuery(q);

Yes, it's in the code block. :c

@umar4911 I've already tried that.

umar4911

@KuRiMi what is the column number of tag and players??
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

D4rkR420R


Mahmoud Tornado


umar4911

#7
local a = 0, b = 0, q = QuerySQL( clan, "SELECT * FROM Members" );
while( GetSQLColumnData( q, 0 ) )
{
 local c1 = QuerySQL( clan, "SELECT * FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 1 ) +"'" );
local c2 = QuerySQL( clan, "SELECT * FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 2 ) +"'" );
 if( GetSQLColumnData( c1, 0  ) != null && GetSQLColumnData(c1, 1)  != null) a++;
 if( GetSQLColumnData( c2, 0 ) != null && GetSQLColumnData(c2, 1)  != null) b++;
Message("[#FFFFFF] Hello"); // for test to see that is it looping
 GetSQLNextRow( q );
}
Remember to remove the Message if the code worked.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

D4rkR420R

Quote from: umar4911 on May 04, 2018, 11:04 AMlocal a = 0, b = 0, q = QuerySQL( clan, "SELECT * FROM Members" );
while( GetSQLColumnData( q, 0 ) )
{
 local c1 = QuerySQL( clan, "SELECT * FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 1 ) +"'" );
local c2 = QuerySQL( clan, "SELECT * FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 2 ) +"'" );
 if( GetSQLColumnData( c1, 0  ) != null && GetSQLColumnData(c1, 1)  != null) a++;
 if( GetSQLColumnData( c2, 0 ) != null && GetSQLColumnData(c2, 1)  != null) b++;
Message("[#FFFFFF] Hello"); // for test to see that is it looping
 GetSQLNextRow( q );
}
Remember to remove the Message if the code worked.

Nu... ;-;.

umar4911

Quote from: KuRiMi on May 04, 2018, 10:20 PM
Quote from: umar4911 on May 04, 2018, 11:04 AMlocal a = 0, b = 0, q = QuerySQL( clan, "SELECT * FROM Members" );
while( GetSQLColumnData( q, 0 ) )
{
 local c1 = QuerySQL( clan, "SELECT * FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 1 ) +"'" );
local c2 = QuerySQL( clan, "SELECT * FROM Members WHERE Tag = '"+ GetTok( arguments, " ", 2 ) +"'" );
 if( GetSQLColumnData( c1, 0  ) != null && GetSQLColumnData(c1, 1)  != null) a++;
 if( GetSQLColumnData( c2, 0 ) != null && GetSQLColumnData(c2, 1)  != null) b++;
Message("[#FFFFFF] Hello"); // for test to see that is it looping
 GetSQLNextRow( q );
}
Remember to remove the Message if the code worked.

Nu... ;-;.
Does it show the message?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Saiyan Attack

#10
for your information, you just move to the next row in "local q" but not in c1 and c2 it stuck in first row. you've to add them also in "GetSQLNextRow". and if it didn't works then show your command and show your database pic.

D4rkR420R

Solved the issue, thanks for your support.