Footer-row example using mysqli

QuestionsFooter-row example using mysqli
Richard asked 10 years ago

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
Abu Ghufran answered 10 years ago

// 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.

http://phplens.com/lens/adodb/docs-adodb.htm

Your Answer

0 + 7 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?