close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Upgrade MySQL to MySQLi

Thread began 3/22/2021 9:47 am by joerg431091 | Last modified 6/21/2021 2:15 pm by Ray Borduin | 1226 views | 25 replies |

joerg431091

Upgrade MySQL to MySQLi

Hi guys,

I had to put everything on hold for quite some time but want to get "back on the horse" and upgrade my websites from MySQL to MySQLi now.

So I apologize should I ask the question that probably has been answered many times before.....but is the new Data Bridge v2 all I need to change my sites from MySQL to MySQLi and is it rather easy to upgrade?

Thanks a lot and best regards,

Joerg

Sign in to reply to this post

Ray BorduinWebAssist

It is relatively easy to do if you used the server behaviors to create the pages in the first place. It can be time consuming if you have a lot of pages in your site or if you did a lot of hand coding.

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

joerg431091

Thanks Ray, very glad to see you are still around. I will try but just in case = are you still available to help in case I will not be able to do this myself? You guys had always been fantastic in assisting through the support forums and I want to make sure that this is still available.

Sign in to reply to this post

Ray BorduinWebAssist

Yes. I can help here or we could do a paid support ticket and I could show you how in a screen sharing session over the phone.

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

joerg431091

Thanks as always Ray. I will upgrade and get back to you should I need any help. Thanks again and be well!

Sign in to reply to this post

joerg431091

Hi Ray,

I am ready to work on the changes from MySQL to MySQLi. Before I use the new Data Bridge v2, I wanted to check back with you to see what the best way is to approach that.

I originally used Data Bridge to create the pages but have done a lot of design and code changes since then. I am not sure how exactly the process of migrating MySQL to MySQLi works using Data Bridge v2 but like to avoid that I somehow lose all my changes and ultimately end up having a site that works on PHP 7+ but defaults back to a basic design or something.

So can I use Data Bridge v2 to migrate without loosing the look and feel of my site and, maybe, later have you help to tweak the code or is it better to do a paid support ticket in the first place.

If you could have a look at my website at www.navariniusa.com and let me know whether using Data Bridge v2 should work, that would be great.

Thanks so much!

Best,
Joerg

Sign in to reply to this post

Ray BorduinWebAssist

The steps are:

1) Create a new MySQLi Connection
2) open a page you want to update
3) go to the server behaviors panel
4) Open any recordsets on the page from the server behaviors panel and change the connection to your new mysqli connection and click 'ok'
5) Open any insert, update, or delete server behaviors and update the connection

That should do it. You just run into hand coding issues if they no longer show up in the server behaviors panel. In that case, maybe hire me to work with you in a premier support ticket to manually update those sections.

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

joerg431091

Thanks Ray. Perfect, as always! Will do and utilize the support ticket for manual updates. Thanks so much and have a great day!

Sign in to reply to this post

joerg431091

Hi Ray,

I upgraded to the DataBridge v2 and started as you described in your previous post. It seems pretty straight forward but I am now probably running into some coding issues / MySQL - MySQLi conflicts. I am trying to learn and fix some of them myself but want to ask you to help with the first problems - maybe they help with the other pages too.

I have not uploaded to the server yet so the following error message refer to my local MAMP:


In the "/products_result.php" page I get the following error:

Notice: Undefined index: ProductCategoryID in /Applications/MAMP/htdocs/NavariniUSA/products_results.php on line 10

Notice: Undefined index: ProductSubCat2ID in /Applications/MAMP/htdocs/NavariniUSA/products_results.php on line 11

Notice: Undefined index: CategoryID in /Applications/MAMP/htdocs/NavariniUSA/products_results.php on line 24

Fatal error: Uncaught Error: Call to undefined function GetSQLValueString() in /Applications/MAMP/htdocs/NavariniUSA/products_results.php:34 Stack trace: #0 {main} thrown in /Applications/MAMP/htdocs/NavariniUSA/products_results.php on line 34



The first notice messages refer to:

Line 10:
$WADAproducts->bindParam("i", "".($_GET['ProductCategoryID']) ."", "-1"); //ProductCategory

Line 11:
$WADAproducts->bindParam("i", "".($_GET['ProductSubCat2ID']) ."", "-1"); //subcategory3

Line 24:
$rs_Categories->bindParam("i", "".($_GET['CategoryID']) ."", "-1"); //CatName

The Fatal error to:

Line 34:
$query_rs_SubCategories2 = sprintf("SELECT * FROM subcategories2 WHERE SubCat2ID = %s", GetSQLValueString($SubCat2Name_rs_SubCategories2, "int"));


The entire code above the Doctype is:

<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
<?php require_once('Connections/Amiganien_DB_i.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$WADAproducts = new WA_MySQLi_RS("WADAproducts",$Amiganien_DB_i,0);
$WADAproducts->setQuery("SELECT * FROM products WHERE ProductCategoryID = ? AND ProductStore LIKE '%%NA%%' OR ProductSubCatID = ? AND ProductStore LIKE '%%NA%%' OR ProductSubCat2ID = ? AND ProductStore LIKE '%%NA%%' ORDER BY ProductPrice ASC");
$WADAproducts->bindParam("i", "".($_GET['ProductCategoryID']) ."", "-1"); //ProductCategory
$WADAproducts->bindParam("i", "".($_GET['ProductSubCat2ID']) ."", "-1"); //subcategory3
$WADAproducts->bindParam("i", "".($_GET['ProductSubCatID']) ."", "-1"); //subcategory2
$WADAproducts->execute();
?>
<?php
$rs_SubCategories = new WA_MySQLi_RS("rs_SubCategories",$Amiganien_DB_i,1);
$rs_SubCategories->setQuery("SELECT * FROM subcategories WHERE SubCatID = ?");
$rs_SubCategories->bindParam("i", "".($_GET['SubCatID']) ."", "-1"); //SubCatName
$rs_SubCategories->execute();
?>
<?php
$rs_Categories = new WA_MySQLi_RS("rs_Categories",$Amiganien_DB_i,1);
$rs_Categories->setQuery("SELECT * FROM productcategories WHERE CategoryID = ?");
$rs_Categories->bindParam("i", "".($_GET['CategoryID']) ."", "-1"); //CatName
$rs_Categories->execute();
?>
<?php

$SubCat2Name_rs_SubCategories2 = "-1";
if (isset($_GET['SubCat2ID'])) {
$SubCat2Name_rs_SubCategories2 = $_GET['SubCat2ID'];
}
$Amiganien_DB_i->select_db($database_Amiganien_DB_i);
$query_rs_SubCategories2 = sprintf("SELECT * FROM subcategories2 WHERE SubCat2ID = %s", GetSQLValueString($SubCat2Name_rs_SubCategories2, "int"));
$rs_SubCategories2 = $Amiganien_DB_i->query($query_rs_SubCategories2) or die($mysqli->error);
$row_rs_SubCategories2 = $rs_SubCategories2->fetch_assoc();
$rs_SubCategories->TotalRows2 = $rs_SubCategories2->num_rows;


?>


Any pointer is much appreciated.

Best,
Joerg

Sign in to reply to this post

Ray BorduinWebAssist

It looks like this page is expecting URL parameters that aren't set. In order to avoid this error, just add a check to see if the variable is set when referring to it. So instead of:

php:
$WADAproducts->bindParam("i", "".($_GET['ProductCategoryID']) ."", "-1"); //ProductCategory


use:

php:
$WADAproducts->bindParam("i", "".(isset($_GET['ProductCategoryID'])?$_GET['ProductCategoryID']:"") ."", "-1"); //ProductCategory



and so on for the other lines referenced.

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

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