Event calender not working, need to add filter but dont know
Moderator: General Moderators
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
so you are saying there a few things wrong with the script?
what do you suggest?
what do you suggest?
Re: Event calender not working, need to add filter but dont
Not really. The loop isn't a problem, not doing any harm, I'm just saying it doesn't need to be there.
The point is that you're trying to change the way something works but that script does not work at all. Because of that parse error. Whatever output you're seeing is not coming from that file.
The point is that you're trying to change the way something works but that script does not work at all. Because of that parse error. Whatever output you're seeing is not coming from that file.
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
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.
is it worth me starting again and looking for another calander?
Re: Event calender not working, need to add filter but dont
I don't think we're hearing each other. That file you posted will not run. Period. Nothing in it will work because PHP will not execute it in the first place. Now, you're saying you have something that's (at least partially) working? The file being run must necessarily not be the file you showed. What is the file that's working right now?
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
this is the script that is working running on a live webpage. the only thing that isnt working is the link to the cart
the button
like is say this page loads the information from the calender page
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>Re: Event calender not working, need to add filter but dont
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.
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.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Event calender not working, need to add filter but dont
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.
(#10850)
Re: Event calender not working, need to add filter but dont
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.
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
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.
should the page be displaying the results if it set up like this?
<? echo $date . " at " . $time; ?>
<? echo $info['event_title']; ?>
<? echo $info['event_desc']; ?>
<? echo "£" . $info['event_price']; ?>
because it is or should it just not run.?
if it should still run then if i add another} then should that make the rest of it work?
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
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.
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
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.
Re: Event calender not working, need to add filter but dont
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).
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
i still have got knowhere with this script working and now have been told this is a very old piece of script and shouldn't be used. Can you suggest what i can do instead or if i can continue to work on this to get it to work?
thanks
thanks
Re: Event calender not working, need to add filter but dont
Ideally you would just use a different calendar system. Or make one yourself (it's really not that complicated).
If you've solved the "this file has a parse error and can't possibly run so it must not be this file that's running" problem then you could also just get the job over with and put off an upgrade to a new codebase until you have free time.
If you've solved the "this file has a parse error and can't possibly run so it must not be this file that's running" problem then you could also just get the job over with and put off an upgrade to a new codebase until you have free time.
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: Event calender not working, need to add filter but dont
Thats the trouble, I havnt solved this I understand that it shouldnt run but am unsure where the curly bracket that is missing shoukd go.