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

Need to update some final code from Mysql to Mysqli to get function to work

Thread began 9/12/2019 11:46 pm by lr_leal239405 | Last modified 9/17/2019 6:34 pm by Ray Borduin | 29 views | 4 replies |

lr_leal239405

Need to update some final code from Mysql to Mysqli to get function to work

I'm getting the error on the confirm page:

Warning: mysqli_insert_id() expects parameter 1 to be mysqli, null given in /home/efajp4lnsczo/public_html/confirm.php on line 571

Warning: mysqli_insert_id() expects parameter 1 to be mysqli, null given in /home/efajp4lnsczo/public_html/confirm.php on line 572

Warning: mysqli_select_db() expects parameter 1 to be mysqli, null given in /home/efajp4lnsczo/public_html/webassist/email/waue_confirm_1.php on line 99

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/efajp4lnsczo/public_html/webassist/email/waue_confirm_1.php on line 100

Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home/efajp4lnsczo/public_html/webassist/email/waue_confirm_1.php on line 100


lines 571 and 572 are:

$_SESSION[$WA_sessionName] = mysqli_insert_id($mysqli);
$insertedOrderID = mysqli_insert_id($mysqli);

and 99 and 100 are

mysqli_select_db($mysqli,'resourcesandgifts_db');
$result2 = mysqli_query($mysqli,"SELECT * FROM paradigmsets_dynamic WHERE OrderIDDynamic = '{$_SESSION["eCart1_OrderID"]}'") or die(mysqli_error($mysqli));



If I can get thru that it should work. I changed all the rest of the code to Mysqli.



The full code is below:



<?php
// WA eCart Store Cart Details in Db
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) // Trigger
{
$WA_connection = $HOW_FreeGiftsPlus_Conx;
$WA_table = "orderdetails";
$WA_redirectURL = "";
$WA_indexField = "DetailOrderID";
$WA_fieldNamesStr = "DetailOrderID|DetailProductID|MessageNumber|DetailName|DetailPrice|DetailQuantity";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".((isset($_SESSION["eCart1_OrderID"]))?$_SESSION["eCart1_OrderID"]:"") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("ID") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("MessageNumber") ."") . "|" . "".$eCart1->DisplayInfo("Name") ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Price") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Quantity") ."");
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|none,none,NULL|',none,''|none,none,NULL|none,none,NULL";
$WA_sql = "";
mysqli_select_db($WA_connection,$database_HOW_FreeGiftsPlus_Conx); $indexFieldIndex = -1;
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
if (!session_id()) session_start();
if ($WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos('?', $WA_redirectURL) === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
for ($i = 0; $i < sizeof($WA_fieldNames); $i++)
{
if ($WA_indexField == $WA_fieldNames[$i])
{
$indexFieldIndex = $i;
break;
}
}
$deleteFieldValue = $WA_fieldValues[$indexFieldIndex];
if (isset($deleteFieldValue) && $deleteFieldValue != "")
{
$deleteParamsObj = WA_generateInsertParams(array($WA_indexField), array($WA_columns[$indexFieldIndex]), array($deleteFieldValue), -1);
$WA_sql = "Delete from " . $WA_table . " where " . $WA_indexField . " = " . $deleteParamsObj->WA_dbValues;
$WA_editCmd = mysqli_query($WA_connection,$WA_sql) or die(mysqli_error($mysqli));
$WA_okToDelete = false;
}
$eCart1->MoveFirst();
while (!$eCart1->EOF())
{
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".((isset($_SESSION["eCart1_OrderID"]))?$_SESSION["eCart1_OrderID"]:"") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("ID") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("MessageNumber") ."") . "|" . "".$eCart1->DisplayInfo("Name") ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Price") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Quantity") ."");
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$insertParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_sql = "insert into ".$WA_table." (".$insertParamsObj->WA_tableValues.") values (".$insertParamsObj->WA_dbValues.")";
//$WA_editCmd = mysqli_query($WA_connection,$WA_sql) or die(mysqli_error($mysqli));
$eCart1->MoveNext();
}
if ($WA_redirectURL != "") {
header("Location: ".$WA_redirectURL); exit;
}
$eCart1->MoveFirst();
}
?>



while (!$eCart1->EOF()) {

$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . " <tr>\r\n";
$MailBody = $MailBody . " <td style=\"font-size: 1px; line-height: 1px; width: 5px; padding: 0px; margin: 0px;\">&nbsp;</td>\r\n";
$MailBody = $MailBody . " \r\n";
$MailBody = $MailBody . " <td style=\"padding: 10px 7px 10px 7px; vertical-align: top; border-right: 1px dotted #666666; /* Global_Gray */ text-align-left;\">\r\n";
$MailBody = $MailBody . " <img style='width:40px; height='auto' src=\"http://www.theoracleuncensored.com/images/";
$MailBody = $MailBody . $eCart1->DisplayInfo("Thumbnail");
$MailBody = $MailBody . "\" alt=\"Product thumbnail\" style=\"float:left; margin-right:10px;\" />\r\n";
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . "<p style=\"font-weight:bold; margin:0 0 2px 0;\">";
$MailBody = $MailBody . $eCart1->DisplayInfo("Name");
$MailBody = $MailBody . "</p>\r\n";
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . " </td>\r\n";

$MailBody = $MailBody . " ";
$dName = $eCart1->DisplayInfo("Name");
if ((strpos($dName,'mp4') !== false) || (strpos($dName,'mp4') !== false)) {
$length = strlen($dName);
$characters = 4;
$start = $length - $characters;
mysqli_select_db($mysqli,'resourcesandgifts_db');
$result2 = mysqli_query($mysqli,"SELECT * FROM paradigmsets_dynamic WHERE OrderIDDynamic = '{$_SESSION["eCart1_OrderID"]}'") or die(mysqli_error($mysqli));
$downloadLinkIDs = array();
if($result2) {
while($row = mysqli_fetch_array($result2)) {
$downloadLinkIDs[$row['MessageNumber']] = $row['IDEncrypt'];
}
}
$MailBody = $MailBody . "video - please allow time for large file download here" . "<br>";
$dDownloadName = (isset($downloadLinkIDs[$eCart1->DisplayInfo('MessageNumber')])) ? $downloadLinkIDs[$eCart1->DisplayInfo('MessageNumber')] : '';
$MailBody = $MailBody . "<u>" . "<a href='http://69.67.55.233/downloadmp4paradigm.php?file=".$dDownloadName."'>". $dName . "</a>" . "</u>";
}

else {
$MailBody = $MailBody . $dName;
}


This is for the site:

Sign in to reply to this post

Ray BorduinWebAssist

It looks like you have you update your store cart summary in database and store cart details in database server behaviors on the main page, and then update the recordset used in the email body.

This is something I could help with in a premier support ticket, but it should be easy enough to do on your own. Make sure you have the latest version of eCart and open and re-apply the two server behaviors that store data in the database using your MySQLi connection.

Then in the email body, just delete the lines you sent and replace it with a MySQLi recordset with the same query. Then find any code that refers to $result2 and update it as well. It looks like only a couple of lines.

Sign in to reply to this post

lr_leal239405

I keep getting the old MySQL code generated.

I have DataBridge 235.zxp, MySQLi_105.zxp and WAeCart_613.zxp.


I can't seem to delete previous versions so I uninstalled Dreamweaver and reinstalled, then reinstalled these extensions, but still.. Get old code. I have it installed on another computer and it generates the right code ?

Sign in to reply to this post

Ray BorduinWebAssist

Are you sure you are using a MySQLi connection? Can you test the connection in Dreamweaver and see results? It determines which version of the code based on the type of connection selected and Dreamweaver has to be able to actually connect to the database when you test the connection. Which code exactly is wrong? Can I see a sample page with the issue? Please attach the connection with the page so I can make sure that isn't wrong somehow.

Sign in to reply to this post

lr_leal239405

I haven't been able to get back to this, but I did try it at work (the other PC) just now (before leaving) and it did the same thing - Inserted old mysql syntax. It does see the db and the connections is set to https. I will check later at night and let you know more. Thanks.

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