close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Binding recordsets to eCart

Thread began 6/20/2016 1:34 am by markdoyle87077 | Last modified 6/20/2016 11:35 am by Ray Borduin | 702 views | 3 replies |

markdoyle87077

Binding recordsets to eCart

When binding a recordset to eCart on my localhost everything works fine. However when I run this on my live server $dmbc_po_itemSupplier = "".($rs_po->getColumnVal("supplier")) .""; does not bind

<?php
$rs_po = new WA_MySQLi_RS("rs_po",$dmbc_database,0);
$rs_po->setQuery("SELECT itemnumber, description, order_quantity, cost, buying_quantity, supplieritemnumber, packingorder, supplier FROM products WHERE supplier = ? AND stockstatus = 'Online' AND (stock-packed-customer_back_orders-pending_online_orders) + ((onorder) * (buying_quantity / selling_quantity)) <= reorder AND visible = 1 ORDER BY packingorder, itemnumber");
$rs_po->bindParam("s", "".(isset($_POST['supplier'])?$_POST['supplier']:"") ."", "-1"); //colname
$rs_po->execute();
?>


<?php
// WA eCart Get Info From MySQLi RS
if (("" == "") && $rs_po->TotalRows > 0) {
$Redirect_redirStr="";
if (function_exists("rel2abs")) {
$Redirect_redirStr = $Redirect_redirStr?rel2abs($Redirect_redirStr,dirname(__FILE__)):"";
}
while(!$rs_po->atEnd()) {
$dmbc_po_itemID = floatval("".($rs_po->getColumnVal("itemnumber")) ."");
$dmbc_po_itemName = "".($rs_po->getColumnVal("itemnumber")) ."";
$dmbc_po_itemDescription = "".($rs_po->getColumnVal("description")) ."";
$dmbc_po_itemThumbnail = "0";
$dmbc_po_itemWeight = floatval("0");
$dmbc_po_itemQuantity = floatval("".($rs_po->getColumnVal("order_quantity")) ."");
$dmbc_po_itemPrice = floatval("".($rs_po->getColumnVal("cost")) ."");
$dmbc_po_itemPack = floatval("".($rs_po->getColumnVal("buying_quantity")) ."");
$dmbc_po_itemSupplierItem = "".($rs_po->getColumnVal("supplieritemnumber")) ."";
$dmbc_po_itemLocation = floatval("".($rs_po->getColumnVal("packingorder")) ."");
$dmbc_po_itemSupplier = "".($rs_po->getColumnVal("supplier")) ."";
$dmbc_po->AddToCart(1, "", $dmbc_po_itemID, $dmbc_po_itemName, $dmbc_po_itemDescription, $dmbc_po_itemThumbnail, $dmbc_po_itemWeight, $dmbc_po_itemQuantity, $dmbc_po_itemPrice, $dmbc_po_itemPack, $dmbc_po_itemSupplierItem, $dmbc_po_itemLocation, $dmbc_po_itemSupplier);
$rs_po->moveNext();
}
if ($Redirect_redirStr != "") {
$dmbc_po->redirStr = $Redirect_redirStr;
}
$rs_po->moveFirst();
$rs_po->Index = 0;
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

Add code to debug the recordset after it opens like:

<?php
var_dump($rs_po);
die();
?>

The result might give you the necessary clues to figure out at least whether the issue is with the recordset or the add to cart.

Then try running the SQL statement in the recordset in phpMyAdmin directly to see if there is an issue with the database.

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

markdoyle87077

I have run the php code and the array looks fine

object(WA_MySQLi_RS)#3 (19) { ["Name"]=> string(5) "rs_po" ["Connection"]=> object(mysqli)#1 (19) { ["affected_rows"]=> int(-1) ["client_info"]=> string(75) "mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $" ["client_version"]=> int(50010) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(8) ["host_info"]=> string(20) "localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(16) "5.1.73-community" ["server_version"]=> int(50173) ["stat"]=> string(137) "Uptime: 443343 Threads: 1 Questions: 14696 Slow queries: 0 Opens: 472 Flush tables: 1 Open tables: 12 Queries per second avg: 0.33" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(536) ["warning_count"]=> int(0) } ["CurrentPage"]=> string(44) "/php/admin/purchasing/new_purchase_order.php" ["Statement"]=> string(349) "SELECT itemnumber, description, order_quantity, cost, buying_quantity, supplieritemnumber, packingorder, supplier FROM products WHERE supplier = ? AND stockstatus = 'Online' AND (stock-packed-customer_back_orders-pending_online_orders) + ((onorder) * (buying_quantity / selling_quantity)) <= reorder AND visible = 1 ORDER BY packingorder, itemnumber" ["ParamTypes"]=> string(1) "s" ["FilterValues"]=> array(0) { } ["ParamValues"]=> array(1) { [0]=> string(6) "Belbal" } ["Results"]=> array(7) { [0]=> array(8) { ["itemnumber"]=> string(5) "10255" ["description"]=> string(35) "Crystal Blue Latex Round 5in/12.5cm" ["order_quantity"]=> int(10) ["cost"]=> string(4) "1.81" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(18) "1008002-100 D5 033" ["packingorder"]=> int(620) ["supplier"]=> string(6) "Belbal" } [1]=> array(8) { ["itemnumber"]=> string(5) "10257" ["description"]=> string(36) "Crystal Clear Latex Round 5in/12.5cm" ["order_quantity"]=> int(10) ["cost"]=> string(4) "1.81" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(18) "1008002-100 D5 038" ["packingorder"]=> int(620) ["supplier"]=> string(6) "Belbal" } [2]=> array(8) { ["itemnumber"]=> string(5) "10259" ["description"]=> string(36) "Crystal Green Latex Round 5in/12.5cm" ["order_quantity"]=> int(10) ["cost"]=> string(4) "1.81" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(18) "1008002-100 D5 035" ["packingorder"]=> int(620) ["supplier"]=> string(6) "Belbal" } [3]=> array(8) { ["itemnumber"]=> string(5) "10260" ["description"]=> string(37) "Crystal Orange Latex Round 5in/12.5cm" ["order_quantity"]=> int(10) ["cost"]=> string(4) "1.81" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(18) "1008002-100 D5 037" ["packingorder"]=> int(620) ["supplier"]=> string(6) "Belbal" } [4]=> array(8) { ["itemnumber"]=> string(5) "10269" ["description"]=> string(35) "Pastel Black Latex Round 5in/12.5cm" ["order_quantity"]=> int(10) ["cost"]=> string(4) "1.72" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(18) "6061001-100 D5 025" ["packingorder"]=> int(620) ["supplier"]=> string(6) "Belbal" } [5]=> array(8) { ["itemnumber"]=> string(5) "10289" ["description"]=> string(36) "Pastel Yellow Latex Round 5in/12.5cm" ["order_quantity"]=> int(10) ["cost"]=> string(4) "1.72" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(18) "6061001-100 D5 006" ["packingorder"]=> int(620) ["supplier"]=> string(6) "Belbal" } [6]=> array(8) { ["itemnumber"]=> string(5) "10012" ["description"]=> string(41) "Pastel Leaf Green Latex Round 11in/27.5cm" ["order_quantity"]=> int(22) ["cost"]=> string(4) "2.78" ["buying_quantity"]=> int(100) ["supplieritemnumber"]=> string(19) "1008001-100 B95 011" ["packingorder"]=> int(630) ["supplier"]=> string(6) "Belbal" } } ["Index"]=> int(0) ["MaxRows"]=> int(0) ["PageNum"]=> int(0) ["PrevPage"]=> int(0) ["NextPage"]=> int(0) ["StartLimit"]=> int(0) ["StartRow"]=> int(1) ["LastRow"]=> int(7) ["TotalRows"]=> int(7) ["TotalPages"]=> int(0) ["QueryString"]=> string(18) "&totalRows_rs_po=7" }

I have also run the sql directly on the database and the records are returned correctly so this leads me to think the issue is with the add to cart.

Sign in to reply to this post

Ray BorduinWebAssist

Yes. The recordset appears to be returning results, so the issue has to be with the add to cart.

What exactly happens when you are trying? Is it possible you haven't uploaded the latest cart object from your localhost and that column doesn't exist yet? Try uploading the WA_eCart folder and see if that fixes it.

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

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