Copy link to clipboard
Copied
i have an event calander from kublabs that i have adapted. the detail page shows the correct event based on the filtering the event_id
but the prblem i am having is i have a query thats send the event to the shopping cart but it is not selecting the correct varialble. I dont know how to say i want the variable that has been passed by the calander - event_id='$_GET[id]'
<?
require_once("includes/config.php");
$db_connection = mysql_connect ($DBHost, $DBUser, $DBPass) OR die (mysql_error());
$db_select = mysql_select_db ($DBName) or die (mysql_error());
$db_table = $TBL_PR . "events";
$query = "SELECT * FROM $db_table WHERE event_id='$_GET[id]' LIMIT 1";
$query_result = mysql_query ($query);
while ($info = mysql_fetch_array($query_result)){
$date = date ("l, jS F Y", mktime(0,0,0,$info['event_month'],$info['event_day'],$info['event_year']));
$time_array = split(":", $info['event_time']);
$time = date ("g:ia", mktime($time_array['0'],$time_array['1'],0,$info['event_month'],$info['event_day'],$info['event_year']));
?>
// *** Add item to Shopping Cart via link ***
$XC_AddLink1 = $_SERVER["PHP_SELF"];
if (!isset($XC_newQS) || $XC_newQS == "") {
$XC_AddLink1 .= "?XC_AddId1=";
} else {
$XC_AddLink1 .= "?" . $XC_newQS . "&XC_AddId1=";
}
$XC_uniqueCol1="event_id";
if (isset($_GET["XC_AddId1"])) {
$NewRS=mysql_query($query_rsEvent, $lotties) or die(mysql_error());
$ln = "1";
$XC_rsName="rsEvent";
$XC_uniqueCol = "XC_uniqueCol$ln";
$XC_redirectTo = "../already-added.php";
$XC_AddViaLinkRedirect = "../shopping-cart.php";
$XC_BindingTypes=array("RS","LITERAL","RS","RS","NONE");
$XC_BindingValues=array("event_id","1","event_title","event_price","");
$XC_BindingLimits=array("","","","","");
$XC_BindingSources=array("","","","","");
$XC_BindingOpers=array("","","","","");
require_once('XCInc/AddToXCartViaLink.inc');
}
?>
i need to tell the
$XC_uniqueCol1="event_id";
to use the event_id='$_GET[id]'
in order to pass the correct information
i should also include the fact that the // *** Add item to Shopping Cart via link *** is getting its information from a different SQL
mysql_select_db($database_lot, $lot);
$query_rsEvent = sprintf("SELECT * FROM calendar_events WHERE event_title = %s", GetSQLValueString($colname_rsEvent, "text"));
$rsEvent = mysql_query($query_rsEvent, $lotties) or die(mysql_error());
$row_rsEvent = mysql_fetch_assoc($rsEvent);
$totalRows_rsEvent = mysql_num_rows($rsEvent);
Copy link to clipboard
Copied
Just assign querystring value to the variable:
$XC_uniqueCol1="$_GET[id]";
Copy link to clipboard
Copied
i have tried this in different variants but it returns an empty results
if i leave it as it was i sends the first record in the database to the cart
http://lottie.com/beta/kubelabs/event.php?id=14&XC_AddId1=13
$XC_AddLink1 = $_SERVER["PHP_SELF"];
if (!isset($XC_newQS) || $XC_newQS == "") {
$XC_AddLink1 .= "?XC_AddId1=";
} else {
$XC_AddLink1 .= "?" . $XC_newQS . "&XC_AddId1=";
}
$XC_uniqueCol1="event_id";
if (isset($_GET["XC_AddId1"])) {
$NewRS=mysql_query($query_rsEvent, $lotties) or die(mysql_error());
$ln = "1";
$XC_rsName="rsEvent";
$XC_uniqueCol = "XC_uniqueCol$ln";
$XC_redirectTo = "../already-added.php";
$XC_AddViaLinkRedirect = "../shopping-cart.php";
$XC_BindingTypes=array("RS","LITERAL","RS","RS","NONE");
$XC_BindingValues=array("event_id","1","event_title","event_price","");
$XC_BindingLimits=array("","","","","");
$XC_BindingSources=array("","","","","");
$XC_BindingOpers=array("","","","","");
require_once('XCInc/AddToXCartViaLink.inc');
}
if i replace the
$XC_uniqueCol1="event_id";
with
$XC_uniqueCol1="$_GET[id]";
it returns an empty result
Find more inspiration, events, and resources on the new Adobe Community
Explore Now