Counting with mysql queries
#1

I made this to count how many houses i have, so i can make loop better.. First time the public works well, so it gives the right answer but if i run this public again it's answer is always zero..

Code:
public totalhouses()
{
	new query[64], Field[64];
	format(query, sizeof(query), "SELECT count(hsqlid) FROM `houses`");
	mysql_query(query);
	mysql_store_result();

	mysql_fetch_field_row(Field, "count(hsqlid)");
	totalhouses = strval(Field);

	mysql_free_result();
	format(query, sizeof(query), "Houses = %d",totalhouses);
	print(query);
	
 	return totalhouses;

}
Whats wrong here ?
Reply
#2

totalhouses = mysql_num_rows();
Reply
#3

Yea, thanks WackoX . It helped me !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)