Page 2 of 3

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 1:46 pm
by jonnyfortis
so you are saying there a few things wrong with the script?

what do you suggest?

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 2:16 pm
by requinix
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.

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 2:22 pm
by jonnyfortis
Whatever output you're seeing is not coming from that file.
could it be coming from the previous page?
The point is that you're trying to change the way something works but that script does not work at all.
but it is working as much as im getting the dates. the bit that isnt working is the sending to the cart

is it worth me starting again and looking for another calander?

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 2:52 pm
by requinix
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?

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 3:12 pm
by jonnyfortis
this is the script that is working running on a live webpage. the only thing that isnt working is the link to the cart

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');
}
?>
the button

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>
like is say this page loads the information from the calender page

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 4:03 pm
by requinix
jonnyfortis wrote:this is the script that is working running on a live webpage.
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

Posted: Fri Feb 22, 2013 11:05 pm
by Christopher
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.

Re: Event calender not working, need to add filter but dont

Posted: Fri Feb 22, 2013 11:10 pm
by Benjamin
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.
Wrapped in a while loop..

Re: Event calender not working, need to add filter but dont

Posted: Sat Feb 23, 2013 4:44 am
by jonnyfortis
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.
im confused aswell.

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?

Re: Event calender not working, need to add filter but dont

Posted: Sat Feb 23, 2013 4:45 am
by jonnyfortis
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.
that is not pasted togeather, that is how it came

Re: Event calender not working, need to add filter but dont

Posted: Fri Mar 01, 2013 5:24 am
by jonnyfortis
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.
do you know where i should ad the } in order to see if this will solve this issue?

Re: Event calender not working, need to add filter but dont

Posted: Fri Mar 01, 2013 12:37 pm
by requinix
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).

Re: Event calender not working, need to add filter but dont

Posted: Thu Mar 14, 2013 5:25 am
by jonnyfortis
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

Re: Event calender not working, need to add filter but dont

Posted: Thu Mar 14, 2013 12:42 pm
by requinix
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.

Re: Event calender not working, need to add filter but dont

Posted: Thu Mar 14, 2013 1:27 pm
by jonnyfortis
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.