Re: Event calender not working, need to add filter but dont
Posted: Fri Feb 22, 2013 1:46 pm
so you are saying there a few things wrong with the script?
what do you suggest?
what do you suggest?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
could it be coming from the previous page?Whatever output you're seeing is not coming from that file.
but it is working as much as im getting the dates. the bit that isnt working is the sending to the cartThe point is that you're trying to change the way something works but that script does not work at all.
Code: Select all
<?php require_once('XCInc/XCaddLink.inc'); ?>
<?php require_once('../Connections/lot.php'); ?>
<?
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']));
?>
<?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";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
// *** X Shopping Cart ***
$useSessions = true;
$XCName = "LotCart";
$XCTimeout = 30;
$XC_ColNames=array("ProductID","Quantity","Name","Price","Total");
$XC_ComputedCols=array("","","","","Price");
require_once('XCInc/XCart.inc');
mysql_select_db($database_lot, $lot);
$query_rsEvent = "SELECT * FROM calendar_events";
$rsEvent = mysql_query($query_rsEvent, $lot) or die(mysql_error());
$row_rsEvent = mysql_fetch_assoc($rsEvent);
$totalRows_rsEvent = mysql_num_rows($rsEvent);
// *** 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');
}
?>Code: Select all
<a href="<?php echo $XC_AddLink1 . $row_rsEvent[$XC_uniqueCol1]; ?>" onmouseout="MM_nbGroup('out');" onmouseover="MM_nbGroup('over','addToCart_r2_c2_s1','../images/addToCart/addToCart_r2_c2_s2.gif','../images/addToCart/addToCart_r2_c2_s3.gif',1);" onclick="MM_nbGroup('down','navbar1','addToCart_r2_c2_s1','../images/addToCart/addToCart_r2_c2_s3.gif',1);"><img name="addToCart_r2_c2_s1" src="../images/addToCart/addToCart_r2_c2_s1.gif" width="107" height="11" border="0" id="addToCart_r2_c2_s1" alt="" /></a>No it is not working. That parse error will prevent the script from running. At all. It simply will not run.jonnyfortis wrote:this is the script that is working running on a live webpage.
Wrapped in a while loop..Christopher wrote:That looks like three or four different pieces of code pasted together. There has to be other stuff going on if there is an if() around a function.
im confused aswell.No it is not working. That parse error will prevent the script from running. At all. It simply will not run.
Count the number of {s in your code. I count 8. Not count the number of }s. I count 7. They do not match.
I don't know what's running right now but it is not the code you posted.
that is not pasted togeather, that is how it cameThat looks like three or four different pieces of code pasted together. There has to be other stuff going on if there is an if() around a function.
do you know where i should ad the } in order to see if this will solve this issue?No it is not working. That parse error will prevent the script from running. At all. It simply will not run.
Count the number of {s in your code. I count 8. Not count the number of }s. I count 7. They do not match.
I don't know what's running right now but it is not the code you posted.
requinix wrote:Yes, still missing. It doesn't look like you should have that loop in the first place, but more important is the fact that this script can't possibly run, suggesting that you're editing the wrong file(s).