Code:
result = dbi_query(dbc,"SELECT value FROM table");
if(result <= RESULT_FAILED)
{
new szError[76];
dbi_error(dbc , szError , 75);
server_print("[MyPlug] Error in SQL : %s" , szError);
}
else
{
new szAppend[126] , iLen;
new szValue[36]; // or new iValue; or new Float:fValue;
while(dbi_nextrow(result))
{
//Note: this isn't appending to the string. It is replacing it everytime.
dbi_result(result , "value" , szValue , 35);
//or iValue = dbi_result( result , "value");
//or dbi_result( result , "value" , fValue);
//This is how you can append a value to a string.
iLen += format(szAppend[iLen] , 125 - iLen , "%s" , szValue);
//or iLen += format(szAppend[iLen] , 125 - iLen , "%d" , iValue);
//or iLen += format(szAppend[iLen] , 125 - iLen , "%f" , fValue);
}
dbi_free_result(result)
}