How to convert this so it works with mysqli?
pastebin link is http://pastebin.com/raw.php?i=CZT9JXAH
function pre_render($data)
{
$rows = $_GET["jqgrid_page"] * $_GET["rows"];
$sidx = $_GET['sidx']; // get index row – i.e. user click to sort
$sord = $_GET['sord']; // get the direction
// same sql as in select_command
$rs = mysql_fetch_assoc(mysql_query("SELECT SUM(total) as s FROM (SELECT total FROM invheader ORDER BY $sidx $sord LIMIT $rows) AS tmp"));
foreach($data["params"] as &$d)
{
$d["running_total"] = $rs["s"];
}
}
1 Answers
// you can also use grid object to execute sql, useful in non-mysql driver
global $grid;
$rs = $grid->con->execute("MY-SQLi query");
The grid uses php adodb library and it return recordset object.
Your Answer