SA-MP Forums Archive
select a row - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: select a row (/showthread.php?tid=621974)



select a row - DetoNater - 17.11.2016

i have query like this one



and my code is this one

Код:
	//doublescore weekend 
	{
	new dsquery[40], dsyear, dsmonth, dsday;
	getdate(dsyear, dsmonth, dsday);
	mysql_format(mysql,dsquery,sizeof(dsquery),"SELECT WEEKDAY('%d-%d-%d')",dsyear,dsmonth,dsday);
	mysql_query(mysql,dsquery);
	new dscheck = cache_get_row_int(0,0);
	if(dscheck == 5 && dscheck == 6)
    {
      dsweekend = 1;
    }
    else dsweekend = 0;
    printf("[DOUBLESCORE_WEEKEND]Date : %d-%d-%d : Weekday: %s : Active : ",dsyear,dsmonth,dsday,dscheck,dsweekend);
	}
but i get this one instead of the date's index....

Код:
[17/11/2016 06:30:33] [MYSQL] Connection with the database: SUCCESS!
[17/11/2016 06:30:33] ----------------------------------------------------- 
[17/11/2016 06:30:33] [DOUBLESCORE_WEEKEND]Date : 2016-11-17 : Weekday: аSELECT WEEKDAY('2016-11-17') : Active : 
[17/11/2016 06:30:33]   
[17/11/2016 06:30:33] BFScript is loaded. By Slawi, Mr.Moon, Kiets & DetoNater.

[17/11/2016 06:30:33]   
[17/11/2016 06:30:33] Number of vehicle models: 56



Re: select a row - Konstantinos - 17.11.2016

How is it possible for dscheck to be both 5 and 6 at the same time. Another thing is that it is an integer thus %d or %i specifier, you've used %s for strings.

If you are to use non-threaded queries, delete the cache from memory to avoid memory leaks: https://sampwiki.blast.hk/wiki/MySQL/R33#cache_delete


Re: select a row - DetoNater - 17.11.2016

-Fixed- thank you, and can you give example of cache_delete?? for the above function, i dont know which is the cache_id


Re: select a row - Konstantinos - 17.11.2016

An example is shown here: https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_query