MySQL, rows checking.
#1

Uh, hi there.

I want to check how many rows I have in.. let's say my accounts table, that should give me the amount of registered players, I believe.

I'm not quite sure how to do it, I tried asking ****** first, but since I am asking it here as well, you can only assume I did not find an answer to my question.

Thanks in advance.
Reply
#2

learn to ****** first
use mysql_num_rows() function after storing the result which will return number of rows
Reply
#3

I did that, it said these functions aren't defined. I have the MySQL include etc. I don't see what the problem is.
Reply
#4

Which version of MySQL are you using?
Reply
#5

MySQL R33, ye, I checked around and it seems I need MySQL R7? I'm downloading it.

EDIT: Can't seem to find a proper download link, anywhere. Not even on the official post. -.-
Reply
#6

It's not so nessesary, just call a callback with the query execution (use threaded query)
pawn Код:
// Example:
public OnPlayerConnect(playerid)
{
mysql_tquery(1, "SELECT * FROM accounts WHERE name = 'myname'", "LoadPlayerData", "i", playerid);
return 1;
}

forward LoadPlayerData(playerid);

public LoadPlayerData(playerid)
{
//now here you can use cache functions as cache_num_rows(); which means the same thing as mysql_num_rows
return 1;
}
+rep if helped
Reply
#7

Thank you, kamili, +rep.
Reply
#8

I tried to do something with mysql_num_rows() and I didn't recieve any errors. O.o
Reply
#9

Using the inbuilt COUNT() function is probably faster than calling mysql_num_rows, since much less information will be transmitted and stored in memory.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)