close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

a bit more mysql to mysqli

Thread began 4/17/2015 11:27 am by Jamie | Last modified 4/21/2015 10:37 am by Ray Borduin | 1752 views | 5 replies |

Jamie

a bit more mysql to mysqli

Hey Ray

Just trying to convert the last bit of the mysql product options to mysqli as the site I am working on now is using mysqli and there is obviously code mismatch as originally we put the options element in using mysql.

In the attached product detail page, the RS on lines 81 - 94 am not sure how to convert to mysqli so that I am able to successfully pass the item option in the ard to cart lines 125 -152

Also, on line 143 should it be

$ATC_itemOptions = "".$AddOption  ."";// column binding

or

$ATC_itemOptions = "".($AddOption->getColumnVal("OptionGroupID"))  ."";// column binding



if you could give me a steer I would appreciate it

many thanks

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

The first one should be correct, but there are other things on the page that have issues that would cause it to not work.

The code that is supposed to be building the $AddOption value is based on a form element on the page named "ProdOptions". I don't see that form element on the page at all right now.

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

Jamie

ooops gotcha. have now added that but am getting the following error when adding to cart:

array(1) { [0]=> string(2) "14" }
Warning: mysql_real_escape_string(): Access denied for user 'natsssss'@'localhost' (using password: NO) in /home/natsssss/public_html/product-s.php on line 19

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/natsssss/public_html/product-s.php on line 19

Warning: mysql_real_escape_string(): Access denied for user 'natsssss'@'localhost' (using password: NO) in /home/natsssss/public_html/product-s.php on line 19

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/natsssss/public_html/product-s.php on line 19

Warning: mysql_query() expects parameter 2 to be resource, object given in /home/natsssss/public_html/product-s.php on line 87
Access denied for user 'natsssss'@'localhost' (using password: NO)
Sign in to reply to this post

Ray BorduinWebAssist

The problem is that the custom code from lines 81-94 hasn't been updated to mysqli and is still referring to mysql that no longer has a connection available. I think those lines need to be updated.

Try:

php:
<?php 

$AddOption 
""
$AddOptionPrice 0
if (isset(
$_POST['ProdOptions'])) { 
  for (
$x=0$x<sizeof($_POST['ProdOptions']); $x++) { 
    
$ProductOptionsSelected = new WA_MySQLi_RS("OptionGroups",$DBConnection,0);
    
$ProductOptionsSelected->setQuery("SELECT * FROM optiongroups INNER JOIN options on options.OptionGroupID = optiongroups.OptionGroupID WHERE optiongroups.OptionGroupID = ? AND OptionID = ?");
    
$ProductOptionsSelected->bindParam("i""".$_POST['ProdOptions'][$x]  ."""-1");
    
$ProductOptionsSelected->bindParam("i""".$_POST['Option_'$_POST['ProdOptions'][$x]]  ."""-1");
    if (
$x>0$AddOption .= "; "
    
$AddOption .= $ProductOptionsSelected->getColumnVal("OptionGroupName") .": " .$ProductOptionsSelected->getColumnVal("OptionName"); 
    
$AddOptionPrice += $ProductOptionsSelected->getColumnVal("OptionPrice"); 
  }

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

Jamie

Thanks Ray

Now its not passing the option or option value to the cart/checkout pages.

Sign in to reply to this post

Ray BorduinWebAssist

I don't see the problem. I'd have to debug it with you.

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