mysql_format into variable.
#4

Nah, you need to fetch the values through the callback by the looks. That function appears to only be a function that formats a query into a string.

pawn Код:
new query[128];
mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `%s` WHERE `bar` = '%e' AND `foobar` = '%f' LIMIT %d", "foobar", "escape'me\"please", 1.2345, 1337);
// the variable 'query' contains now the formatted query (including the escaped string)
mysql_tquery(MySQL, query, "OnStuffSelected", "");
taken from https://sampwiki.blast.hk/wiki/MySQL/R33

Therefore, it should look similar to this (untested, might work tho):

pawn Код:
// query somewhere
mysql_tquery(MySQL, "SELECT MIN(`column`) as `min_val` FROM `table`", "OnStuffSelected", "");

// callback
public OnStuffSelected()
{
    new
        rows, fields;

    cache_get_data(rows, fields);

    if(rows) {
        new minval = cache_get_row_int(0, "min_val"); // 0 = first row
        // do stuff
    }
}
Reply


Messages In This Thread
mysql_format into variable. - by k2168 - 28.07.2015, 13:48
Re: mysql_format into variable. - by Lorenc_ - 28.07.2015, 13:55
Re: mysql_format into variable. - by k2168 - 28.07.2015, 14:11
Re: mysql_format into variable. - by Lorenc_ - 28.07.2015, 14:23
Re: mysql_format into variable. - by k2168 - 29.07.2015, 12:48

Forum Jump:


Users browsing this thread: 1 Guest(s)