The Endless arguments
#1

hi, I want to ask for help in the following function.

Basically I want his method of using it:
GuardarCampo (ID, Table, Field1, Value1, Field2, Value2, etc ..);

I have the following code:
PHP код:
stock GuardarCampostr(id,Tabla[], ...)
{
     new 
Args 2;
     new 
query[256];
     new 
inf_Salida[256];
     
format(inf_Salida,sizeof(inf_Salida),"UPDATE `%s` SET ",Tabla);
     do
     {
         
format(query,sizeof(query),"`%s`=%s,",getarg(Args-1), getarg(Args));
         
Args+=2;
        
strcat(inf_Salida,query);
     }
     while(
Args <= numargs()-1);
     
format(query,sizeof(query),"`%s`=%s WHERE `ID`=%d",getarg(Args-1), getarg(Args),id);
     
strcat(inf_Salida,query);
      
printf(inf_Salida);

But I have a problem and I print it this way:
pawn Код:
UPDATE `svr_cuentas` SET `s`=Ms,``=M,``=M,``= WHERE `ID`=1
It donot really a lot of use of the endless arguments (...)
Reply


Messages In This Thread
The Endless arguments - by mcreed - 03.04.2016, 00:13
Re: The Endless arguments - by PinkFloydLover - 03.04.2016, 05:48

Forum Jump:


Users browsing this thread: 1 Guest(s)