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

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 10/09/2019 1:48 pm by lr_leal239405 | 161 views | 24 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:

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