recordset conversion issue
Hey Ray
Am trying to convert a mysql recordset to mysqli and am getting this error:
SELECT optiongroups.*, group_concat(OptionName) AS options FROM optiongroups Left Outer Join options ON options.OptionGroupID = optiongroups.OptionGroupID WHERE OptionProductID = %s GROUP BY optiongroups.OptionGroupID
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s GROUP BY optiongroups.OptionGroupID LIMIT 0,1000' at line 1
The recordset I am converting i
<?php
$maxRows_WADAoptiongroups = 1000;
$pageNum_WADAoptiongroups = 0;
if (isset($_GET['pageNum_WADAoptiongroups'])) {
$pageNum_WADAoptiongroups = $_GET['pageNum_WADAoptiongroups'];
}
$startRow_WADAoptiongroups = $pageNum_WADAoptiongroups * $maxRows_WADAoptiongroups;
$colname_WADAoptiongroups = "-1";
if (isset($_GET['ProductID'])) {
$colname_WADAoptiongroups = $_GET['ProductID'];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_WADAoptiongroups = sprintf("SELECT optiongroups.*, group_concat(OptionName) AS options FROM optiongroups Left Outer Join options ON options.OptionGroupID = optiongroups.OptionGroupID WHERE OptionProductID = %s GROUP BY optiongroups.OptionGroupID", GetSQLValueString($colname_WADAoptiongroups, "int"));
setQueryBuilderSource($query_WADAoptiongroups,$WADbSearch1,false);
$query_limit_WADAoptiongroups = sprintf("%s LIMIT %d, %d", $query_WADAoptiongroups, $startRow_WADAoptiongroups, $maxRows_WADAoptiongroups);
$WADAoptiongroups = mysql_query($query_limit_WADAoptiongroups, $PowerCMSConnection) or die(mysql_error());
$row_WADAoptiongroups = mysql_fetch_assoc($WADAoptiongroups);
if (isset($_GET['totalRows_WADAoptiongroups'])) {
$totalRows_WADAoptiongroups = $_GET['totalRows_WADAoptiongroups'];
} else {
$all_WADAoptiongroups = mysql_query($query_WADAoptiongroups, $PowerCMSConnection);
$totalRows_WADAoptiongroups = mysql_num_rows($all_WADAoptiongroups);
}
$totalPages_WADAoptiongroups = ceil($totalRows_WADAoptiongroups/$maxRows_WADAoptiongroups)-1;
?>
and the one that is being converted into is this
<?php
$WADAoptiongroups = new WA_MySQLi_RS("WADAoptiongroups",$DBConnection,1000);
$WADAoptiongroups->setQuery("SELECT optiongroups.*, group_concat(OptionName) AS options FROM optiongroups Left Outer Join options ON options.OptionGroupID = optiongroups.OptionGroupID WHERE OptionProductID = %s GROUP BY optiongroups.OptionGroupID");
$WADAoptiongroups->bindParam("i", "".($_GET['ProductID']) ."", "-1"); //colname
$WADAoptiongroups->execute();
?>