close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


code updating 2

Thread began 8/16/2017 11:26 am by Christopher West | Last modified 8/16/2017 4:19 pm by Ray Borduin | 119 views | 2 replies |

Christopher WestCommunity Expert

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:


= 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
Sign in to reply to this post

Ray BorduinWebAssist

Close, but why have you changed the WHERE clause from:
WHERE ProductLink = %s

WHERE REPLACE(ProductName, ' ', '-' ) = ?

other than that they appear to be direct translations of each other and correct.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Ray, good question regarding WHERE REPLACE(ProductName, ' ', '-' ) = ?
Basically I am using a more recent ecommerce website I put together and in that code I used the above where statement so that the URL would always replace any spaces with hythenss in my product names (there was a logical reason for that approach but its been some time since I did it).


Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...