Mysql Number of rows?
#1

hello..

I program in PHP and i thought pawno would be roughly the same...However i am trying to get the number of rows of a query i have done..although "samp_mysql_num_rows" function doesnt take any parameteres?

this is the functions:

native samp_mysql_num_rows();
native samp_mysql_query(query[]);
Reply
#2

You need to store the result, then samp_mysql_num_rows will return the amount of rows.
Reply
#3

so how would i store the rows with tese functions?

Код:
native samp_mysql_connect(server[], user[], password[]);
native samp_mysql_select_db(db[]);
native samp_mysql_query(query[]);
native samp_mysql_store_result();
native samp_mysql_fetch_row(line[]);
native samp_mysql_get_field(field[], value[]);
native samp_mysql_num_rows();
native samp_mysql_num_fields();
native samp_mysql_ping();
native samp_mysql_real_escape_string(src[], dest[]);
native samp_mysql_free_result();
native samp_mysql_strtok(dest[], separator[], src[]);
native samp_mysql_close();
Reply
#4

pawn Код:
new function;
function = samp_mysql_num_rows();
Reply
#5

But i how do i put the

new query

into a variable for the num rows? (from using new function)
Reply
#6

I don't really understand what you are trying to do
Reply
#7

Well im trying to test the number of rows to see if a account exist..

so ive done:

Код:
	format(result,sizeof(result),"SELECT * FROM accounts WHERE user=%s",sqlPlayerName); // Format my query
	samp_mysql_query(result);
I want to store that query into a variable of number of rows.. like

Код:
row = samp_mysql_num_rows(query);

if(row == 0){
blah
}
that sort of idea..
Reply
#8

pawn Код:
format(result,sizeof(result),"SELECT * FROM accounts WHERE user=%s",sqlPlayerName);
samp_mysql_query(result);
samp_mysql_store_result();
if(samp_mysql_num_rows() > 0)
{ blah }
Reply
#9

so when i use samp_mysql_store_result(); it automaticly gets the last query and lets me use samp_mysql_num_rows to refer to that query?
Reply
#10

Last query indeed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)