code updating 2
Hi Ray, I have the following old code (using old mysql server behaviours) and which to change it to mysqli
$colname_ItemOptions = "-1";
if (isset($_GET['Product'])) {
$colname_ItemOptions = $_GET['Product'];
}
mysql_select_db($database_dinkydb, $dinkydb);
$query_ItemOptions = sprintf("SELECT optiongroups.*, OptionRequired, OptionIncluded, ProductOptionID FROM productoptions INNER JOIN optiongroups ON optiongroups.OptionGroupID = productoptions.OptionGroupID INNER JOIN products ON productoptions.ProductID = products.ProductID WHERE ProductLink = %s ORDER BY OptionSort, ProductOptionID", GetSQLValueString($colname_ItemOptions, "text"));
$ItemOptions = mysql_query($query_ItemOptions, $dinkydb) or die(mysql_error());
$row_ItemOptions = mysql_fetch_assoc($ItemOptions);
$totalRows_ItemOptions = mysql_num_rows($ItemOptions);
is below correct change from above:
<?php
$rsItemOptions = new WA_MySQLi_RS("rsItemOptions",$ecartdb,0);
$rsItemOptions->setQuery("SELECT optiongroups.*, OptionRequired, OptionIncluded, ProductOptionID FROM productoptions INNER JOIN optiongroups ON optiongroups.OptionGroupID = productoptions.OptionGroupID INNER JOIN products ON productoptions.ProductID = products.ProductID WHERE REPLACE(ProductName, ' ', '-' ) = ? ORDER BY OptionSort, ProductOptionID");
$rsItemOptions->bindParam("s", "".(isset($_GET['Product'])?$_GET['Product']:"") ."", "-1"); //colname
$rsItemOptions->execute();
?>