close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

code updating 3

Thread began 8/16/2017 8:36 am by Christopher West | Last modified 8/16/2017 1:21 pm by Ray Borduin | 396 views | 3 replies |

Christopher WestCommunity Expert

code updating 3

Hi Ray, I have the following old code (using old mysql server behaviours) and which to change it to mysqli

Im stuck on this old code changing to mysqi

php:
<?php

    $_GET
['OptionGroupID'] = $row_ItemOptions['OptionGroupID'];
$colname_ItemGroupOptions "-1";
if (isset(
$_GET['OptionGroupID'])) {
  
$colname_ItemGroupOptions $_GET['OptionGroupID'];
}
mysql_select_db($database_dinkydb$dinkydb);
$query_ItemGroupOptions sprintf("SELECT * FROM options WHERE OptionGroupID = %s ORDER BY OptionPrice, OptionName"GetSQLValueString($colname_ItemGroupOptions"int"));
$ItemGroupOptions mysql_query($query_ItemGroupOptions$dinkydb) or die(mysql_error());
$row_ItemGroupOptions mysql_fetch_assoc($ItemGroupOptions);
$lowPrice $row_ItemGroupOptions["OptionPrice"];
?>



I got as far as this:

php:
<?php

$rsItemGroupOptions 
= new WA_MySQLi_RS("rsItemGroupOptions",$ecartdb,0);
$rsItemGroupOptions->setQuery("SELECT * FROM options WHERE OptionGroupID = ? ORDER BY OptionPrice, OptionName");
$rsItemGroupOptions->bindParam("s""".(isset($_GET['OptionGroupID'])?$_GET['OptionGroupID']:"")  ."""-1"); //colname
$lowPrice $rsItemGroupOptions["OptionPrice"];                   
$rsItemGroupOptions->execute();
?>



But when I run the code, it doesnt like: $lowPrice = $rsItemGroupOptions["OptionPrice"]; inside the recordset.

and I am stuck on $_GET['OptionGroupID'] = $row_ItemOptions['OptionGroupID']; which I need to place in the mysqli bindParam section.

Chris

Sign in to reply to this post

Ray BorduinWebAssist

I think you want:


php:
<?php

$rsItemGroupOptions 
= new WA_MySQLi_RS("rsItemGroupOptions",$ecartdb,0);
$rsItemGroupOptions->setQuery("SELECT * FROM options WHERE OptionGroupID = ? ORDER BY OptionPrice, OptionName");
$rsItemGroupOptions->bindParam("s""".(isset($_GET['OptionGroupID'])?$_GET['OptionGroupID']:"")  ."""-1"); //colname
$rsItemGroupOptions->execute();
$lowPrice $rsItemGroupOptions->getColumnVal("OptionPrice");                   
?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Christopher WestCommunity Expert

Thank you Ray, I appricate the help. I am a little wiry of these code changes I am making, but are essential as the more recent ecommerce code I created a while ago is more robust and easier to maintain. The code is pretty easy to adapt but of course the only challenge is ensuring that the product options (custom code that you did for me) is updated to use MySQLi references...the next challenge would be to directly edit the eCart_PHP.php file manually and to add in all the product option code line by line. I no longer use Dreamweaver (I cancelled my subscription) so I am having to hand code using Brackets IDE. Scary stuff.

Chris

Sign in to reply to this post

Ray BorduinWebAssist

Good luck.

Sign in to reply to this post
Did this help? Tips are appreciated...

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

Content

rating

Layout

rating

Ease of use

rating

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