06.08.2016, 20:41
Hi, I made a function who search in players data base the phone nubmer, and make a random phone number,
and i made if any account have the random generated number, to repeat the function, but is not work, what is wrong with him?
In my database there are 3 account with numberphone 0 1 and 2, and the function should return 3 but not do it
I put one charcter to be simple to use
and i made if any account have the random generated number, to repeat the function, but is not work, what is wrong with him?
HTML Code:
pc FindPhone()
{
// new Cache:Result,Get[2], randomphonenumber = 1000000 + random(9999999);
new Cache:Result,Get[2],randomphonenumber = 1 + random(2);
Result = mysql_query(handle,"SELECT * FROM `players`");
Get[0]= cache_num_rows();
for(new x;x<Get[0];x++)
{
format(strings, sizeof(strings), "SELECT * FROM `players` WHERE `ID` = %d", x);//
Result = mysql_query(handle,strings);
cache_get_field_content(0, "PhoneNumber", temp), Get[1] = strval(temp);
printf("%d",Get[1]);
if(randomphonenumber==Get[1])
{
FindPhone();
return 1;
}
}
printf("final %d %d",randomphonenumber);
cache_delete(Result);
return 1;
}
I put one charcter to be simple to use


