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

rating

converting mysql to mysqli

Thread began 5/16/2019 12:50 am by Jamie | Last modified 5/20/2019 4:39 pm by Ray Borduin | 20 views | 3 replies |

Jamie

converting mysql to mysqli

am just trying to convert some old code to mysqli (attached txt files) and pretty sure that the repeat regions on lines 6 and 22 are causing the page not to work but unsure what I should be replacing them with

Cheers

Jamie

Attached Files
mysql.txt
mysqli.txt
Sign in to reply to this post

Ray BorduinWebAssist

Yes. I think at this point you should probably just delete the old repeat region code and apply the MySQLi repeat region manually in its place.

So remove the first instance of the line:

php:
<?php do { ?>


and then remove the lines:

php:
<?php mysql_free_result($ProductOptions); //mysql_free_result($OptionGroups); ?>

              <?php } while ($row_OptionGroups mysql_fetch_assoc($OptionGroups));
            
mysql_data_seek($OptionGroups0);
            
$row_OptionGroups mysql_fetch_assoc($OptionGroups);?>


and select the code in-between and apply the mysqli repeat region using the OptionGroups recordset.

Then it looks like you also have a dynamic select list that wasn't updated to MySQLi. To fix that, delete this code:

php:
<?php do { ?>

                  <option value="<?php echo $ProductOptions->getColumnVal('OptionID')?>"<?php if (!(strcmp($lastSel$ProductOptions->getColumnVal('OptionID')))) {echo "selected=\"selected\"";} ?>><?php echo $ProductOptions->getColumnVal('OptionName')?> <?php echo ($ProductOptions->getColumnVal('OptionIncrement')?" (+ £".(number_format($ProductOptions->getColumnVal('OptionPrice'),2)).")":""); ?></option>
                  <?php
} while ($row_ProductOptions mysql_fetch_assoc($ProductOptions));
  
$rows mysql_num_rows($ProductOptions);
  if(
$rows 0) {
      
mysql_data_seek($ProductOptions0);
      
$row_ProductOptions mysql_fetch_assoc($ProductOptions);
  }
?>



Then highlight the select list and add dynamic attributes from the properties window to make the select list dynamically populated from the ProductOptions recordset. Just choose any column for the option title and value.

Once it is back on the page, then delete the <option> tag added and put back in your custom one by copying and pasting the value from before:

php:
<option value="<?php echo $ProductOptions->getColumnVal('OptionID')?>"<?php if (!(strcmp($lastSel$ProductOptions->getColumnVal('OptionID')))) {echo "selected=\"selected\"";} ?>><?php echo $ProductOptions->getColumnVal('OptionName')?> <?php echo ($ProductOptions->getColumnVal('OptionIncrement')?" (+ £".(number_format($ProductOptions->getColumnVal('OptionPrice'),2)).")":""); ?></option>



I think that should fix the page.

Sign in to reply to this post

Jamie

thanks Ray

its not quite working as its not showing the relevant options as per the PM. Have attached the page

Sign in to reply to this post

Ray BorduinWebAssist

I found a few issues with missing brackets and I think a bad IF statement, but I think they are fixed now. Please download the page and test to see if everything works now with other products.

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

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