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


Messages In This Thread
Counting with mysql queries - by actiwe - 26.02.2010, 12:48
Re: Counting with mysql queries - by WackoX - 26.02.2010, 13:10
Re: Counting with mysql queries - by actiwe - 26.02.2010, 14:36

Forum Jump:


Users browsing this thread: 1 Guest(s)