close ad
 
Important WebAssist Announcement
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 8:46 pm by lr_leal239405 | Last modified 10/09/2019 10:48 am by Ray Borduin | 2677 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:

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
Did this help? Tips are appreciated...

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
Did this help? Tips are appreciated...

lr_leal239405

This post has been deleted.

lr_leal239405

I got thru the above after recreating the connection file (even though it was already mysqli. Thanks).
____________________________________________________________________________________________


I'll need help on this (hopefully you're available when I come home after 5 (6pm). It's on the checkout.

The latest I'm getting is :

Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in /home/efajp4lnsczo/public_html/webassist/email/waue_confirm_1.php on line 99

on the donfirm.php page.

Notice: Undefined variable: mysqli in /home/efajp4lnsczo/public_html/webassist/email/waue_confirm_1.php on line 100

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

Notice: Undefined variable: mysqli 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

Just trying to get through this so that it works. I tried building the Store Summary to DB and Detail DB, but I lose my hashed ids function.

You can log in if you want to take a look at:


The way it works is:

When you get to the confirm.php page it inserts a hashed id into a table. It uses that in the checkout_success.php and the email files so that people can download the audios or videos but can't see the name of the file (only the hashed).

I have it using paypal sandbox but don't have the credentials on me at the moment.

Sign in to reply to this post

Ray BorduinWebAssist

I can't seem to get the FTP access to work. What username and password should I be using?

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

lr_leal239405

use below credentials

Sign in to reply to this post

Ray BorduinWebAssist

I updated the Store Cart Summary in Database, Store Cart Details in Database, Email, and email body file to the latest versions with MySQLi. I think that should solve your issues. I didn't fully test, but now they are all able to be opened and edited in Dreamweaver if you have any remaining issues they should be easy to resolve from here. Let me know if you have any more questions or need more help.

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

lr_leal239405

ok. I wanted the downloads to work with the encryption. I had replaced the insert into db with latest (on a backed up copy), but needed to get the encrypted downloads to work (so I had reverted to the original and changed the mysql to mysql). If what you did all does it... Great.

I'll test everything really late tonight. Thank you.

Sign in to reply to this post
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...