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

Problem pulling data from record set

Thread began 12/05/2011 12:34 pm by bearpawwd431893 | Last modified 12/06/2011 12:37 pm by bearpawwd431893 | 782 views | 8 replies


Problem pulling data from record set

When I add a dynamic add to cart button, I don't get the information for the data set for my shopping cart.

First I attached the recordset1 to the product result page:

Here is the code that I set the filter for form variable = ID: When I test it with ID= 101 it pulls up the information correctly.

//WA eCart Include
<?php require_once('Connections/bearpawwdcostdb.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";
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
return $theValue;

$colname_Recordset1 = "-1";
if (isset($_POST['ID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['ID'] : addslashes($_POST['ID']);
mysql_select_db($database_bearpawwdcostdb, $bearpawwdcostdb);
$query_Recordset1 = sprintf("SELECT * FROM producttable1 WHERE ID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $bearpawwdcostdb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);

Next I insert the dynamic add to cart button with the ID value = 101

Here is the add to cart button cord:

<form name="eCart1_1_ATC_<?php echo $row_Recordset1["101"]; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="<?php echo $row_Recordset1["101"]; ?>" >
<input type="text" name="eCart1_1_Quantity_Add" value="1" size="4" >
<input type="image" src="WA_eCart/Images/Deep Jungle/Btn2_EN_addtocart.gif" border="0" class="eC_ImageButton" value="Add to Cart" name="eCart1_1_ATC">

But when I run the page and try to add the 101 product to my cart, nothing happens.

To test the page and shopping cart links, I set it up as a static button with all the information and the cart worked perfectly.

So why won't the dynamic add to cart button read the info from my record set and insert it into my shopping cart.

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





Ease of use


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