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

How do I upgrade older Data Assist pages from MySQL to MySQLi? I get the following error message on all my pages that use the MySQL database connection. Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the futur

Thread began 9/26/2019 2:00 pm by erinlima318673 | Last modified 9/26/2019 4:41 pm by Ray Borduin | 21 views | 3 replies |

erinlima318673

How do I upgrade older Data Assist pages from MySQL to MySQLi?

I get the following error message on all my pages that use the MySQL database connection. Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/content/29/8748029/html/Connections/conn_inventory.php on line 9. We recently upgraded our PHP to 5.6 and will be upgrading to PHP 7 soon, and I want to fix all my pages so that they function properly when this migration occurs.

Sign in to reply to this post

Ray BorduinWebAssist

You can simply turn off that Depricated message and ignore it for now. You would only be forced to update your code when you go to a php7 server... this is just a warning.

To upgrade you just have to install DataBridge 2 and then open any Recordsets, Insert, Update, and Delete Server behaviors on the page and switch them to the MySQLi connection. Once you click OK with a MySQLi connection, then the code is updated to MySQLi.

Sign in to reply to this post

erinlima318673

Originally Said By: Ray Borduin
  You can simply turn off that Depricated message and ignore it for now. You would only be forced to update your code when you go to a php7 server... this is just a warning.

To upgrade you just have to install DataBridge 2 and then open any Recordsets, Insert, Update, and Delete Server behaviors on the page and switch them to the MySQLi connection. Once you click OK with a MySQLi connection, then the code is updated to MySQLi.  



I did this, and it does update my DB connection to MySQLi, however every page that uses that connection now throws up the following errors causing my pages to not display at all:

Warning: mysql_select_db() expects parameter 2 to be resource, object given in /home/content/29/8748029/html/index.php on line 39

Warning: mysql_query() expects parameter 2 to be resource, object given in /home/content/29/8748029/html/index.php on line 41

those lines are part of the following function on the pages:

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

}mysql_select_db($database_conn_inventory, $conn_inventory);
$query_WADAusedbikes = "SELECT * FROM usedbikes WHERE new_or_used = 'Used' AND usedbikes.Status = 'In Inventory' ORDER BY ModelYear DESC, Importance DESC LIMIT 12";
$WADAusedbikes = mysql_query($query_WADAusedbikes, $conn_inventory) or die(mysql_error());
$row_WADAusedbikes = mysql_fetch_assoc($WADAusedbikes);
$totalRows_WADAusedbikes = mysql_num_rows($WADAusedbikes);
?>


Line 39 refers to: }mysql_select_db($database_conn_inventory, $conn_inventory);
Line 41refers to: $WADAusedbikes = mysql_query($query_WADAusedbikes, $conn_inventory) or die(mysql_error());

Sign in to reply to this post

Ray BorduinWebAssist

You should be creating a new connection, not deleting and updating your old connection.

If you update the existing connection file, then the code on all of the other pages will be out of sync.

You should re-create your old MySQL connection so that your existing pages work.

Then create a new MySQLi connection and update Server Behaviors page by page to use the new connection and the code on the page will be updated to MySQLi to match the connection.

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