Look right below this line, the second one you changed.
$query_Recordset1 = sprintf("$query_R1",
GetSQLValueString($colname_Recordset1, "text"));
should be something like:
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d",
$query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
In my example the individual state query looks like this
$query_R1 = "SELECT * FROM Listings WHERE state = %s";
What you have might be different, but use whatever is after
the sprintf. Just the %s in the line above.
Change the %colname% to whatever is after the sprintf, mine
was %s and not the LIMIT %d