when i check out the values arent picked up in checkout.php - php

values are ok in managecart.php
but soon as i checkout which goes to checkout.php file the values dont pickup from what i have entered into managecart.php
below is the coding i had created for the page (checkout.php) but now it dont seem to work.
<?
session_start();
?>
<?
$strMessageBody .= "$QUANTITY_1 - \$$PRICE_1 - $NAME_1 <br>";
if( $NAME_2 ) {$strMessageBody .= "$QUANTITY_2 - \$$PRICE_2 - $NAME_2 <br>";}
if( $NAME_3 ) {$strMessageBody .= "$QUANTITY_3 - \$$PRICE_3 - $NAME_3 <br>";}
if( $NAME_4 ) {$strMessageBody .= "$QUANTITY_4 - \$$PRICE_4 - $NAME_4 <br>";}
if( $NAME_5 ) {$strMessageBody .= "$QUANTITY_5 - \$$PRICE_5 - $NAME_5 <br>";}
if( $NAME_6 ) {$strMessageBody .= "$QUANTITY_6 - \$$PRICE_6 - $NAME_6 <br>";}
if( $NAME_7 ) {$strMessageBody .= "$QUANTITY_7 - \$$PRICE_7 - $NAME_7 <br>";}
if( $NAME_8 ) {$strMessageBody .= "$QUANTITY_8 - \$$PRICE_8 - $NAME_8 <br>";}
if( $NAME_9 ) {$strMessageBody .= "$QUANTITY_9 - \$$PRICE_9 - $NAME_9 <br>";}
if( $NAME_10 ){$strMessageBody .= "$QUANTITY_10 - \$$PRICE_10 - $NAME_10 <br>";}
if( $NAME_11 ){$strMessageBody .= "$QUANTITY_11 - \$$PRICE_11 - $NAME_11 <br>";}
if( $NAME_12 ){$strMessageBody .= "$QUANTITY_12 - \$$PRICE_12 - $NAME_12 <br>";}
if( $NAME_13 ){$strMessageBody .= "$QUANTITY_13 - \$$PRICE_13 - $NAME_13 <br>";}
if( $NAME_14 ){$strMessageBody .= "$QUANTITY_14 - \$$PRICE_14 - $NAME_14 <br>";}
if( $NAME_15 ){$strMessageBody .= "$QUANTITY_15 - \$$PRICE_15 - $NAME_15 <br>";}
if( $NAME_16 ){$strMessageBody .= "$QUANTITY_16 - \$$PRICE_16 - $NAME_16 <br>";}
if( $NAME_17 ){$strMessageBody .= "$QUANTITY_17 - \$$PRICE_17 - $NAME_17 <br>";}
if( $NAME_18 ){$strMessageBody .= "$QUANTITY_18 - \$$PRICE_18 - $NAME_18 <br>";}
if( $NAME_19 ){$strMessageBody .= "$QUANTITY_19 - \$$PRICE_19 - $NAME_19 <br>";}
if( $NAME_20 ){$strMessageBody .= "$QUANTITY_20 - \$$PRICE_20 - $NAME_20 <br>";}
if( $NAME_21 ){$strMessageBody .= "$QUANTITY_21 - \$$PRICE_21 - $NAME_21 <br>";}
if( $NAME_22 ){$strMessageBody .= "$QUANTITY_22 - \$$PRICE_22 - $NAME_22 <br>";}
if( $NAME_23 ){$strMessageBody .= "$QUANTITY_23 - \$$PRICE_23 - $NAME_23 <br>";}
if( $NAME_24 ){$strMessageBody .= "$QUANTITY_24 - \$$PRICE_24 - $NAME_24 <br>";}
if( $NAME_25 ){$strMessageBody .= "$QUANTITY_25 - \$$PRICE_25 - $NAME_25 <br>";}
if( $NAME_26 ){$strMessageBody .= "$QUANTITY_26 - \$$PRICE_26 - $NAME_26 <br>";}
if( $NAME_27 ){$strMessageBody .= "$QUANTITY_27 - \$$PRICE_27 - $NAME_27 <br>";}
if( $NAME_28 ){$strMessageBody .= "$QUANTITY_28 - \$$PRICE_28 - $NAME_28 <br>";}
$wcart = $strMessageBody;
$strMessageBody2 .= "$TOTAL";
$wcart = $strMessageBody;
$wtotal = $strMessageBody2;
?>
this i feel is where the data is being lost any ideas?
managecart.php page below
<?
session_start();
include("includes/db.php");
include("includes/phpscripts.php");
include('includes/settings.php');
if($_GET["action"] == "addcat")
{
$GETCATNAME = str_replace("'","''",$_REQUEST['CATNAME']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "INSERT INTO SHOPCAT VALUES ('','$GETCATNAME','0')";
mysql_query($query);
}
if($_GET["action"] == "editcat")
{
$GETCATNAME2 = str_replace("'","''",$_REQUEST['CATNAME2']);
$GETSHOPCAT2 = str_replace("'","''",$_REQUEST['SHOPID2']);
$GETSOLDOUT2 = str_replace("'","''",$_REQUEST['SOLDOUT2']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "UPDATE SHOPCAT SET CATNAME = '$GETCATNAME2', SOLDOUT = '$GETSOLDOUT2' WHERE SHOPID = '$GETSHOPCAT2'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
if($_GET["action"] == "saveproduct")
{
$SAVEPID = str_replace("'","''",$_REQUEST['PID']);
unset($imagename);
if(!isset($_FILES) && isset($HTTP_POST_FILES))
$_FILES = $HTTP_POST_FILES;
if(!isset($_FILES['image_file']))
$error["image_file"] = "An image was not found.";
$newphrase = $SAVEPID.".jpg";
$imagename = str_replace(" ", "-", $newphrase);
if(empty($imagename))
$error["imagename"] = "The name of the image was not found.";
if(empty($error))
{
$newimage = $imagename;
if(basename($_FILES['image_file']['name']) == "")
{
}
else
{
$result = #move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";
$source = $imagename;
$target = "products/$source";
$width = 200;
$height = 133;
$quality = 100;
$size = getimagesize($source);
//scale evenly
$ratio = $size[0] / $size[1];
if ($ratio >= 1){
$scale = $width / $size[0];
} else {
$scale = $height / $size[1];
}
// make sure its not smaller to begin with!
if ($width >= $size[0] && $height >= $size[1]){
$scale = 1;
}
$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($size[0] * $scale, $size[1] * $scale);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $size[0] * $scale, $size[1] * $scale, $size[0], $size[1]);
imagejpeg($im_out, $target, $quality);
imagedestroy($im_out);
imagedestroy($im_in);
$result = #move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";
$source = $imagename;
$target = "products/large/$source";
$width = 600;
$height = 400;
$quality = 100;
$size = getimagesize($source);
//scale evenly
$ratio = $size[0] / $size[1];
if ($ratio >= 1){
$scale = $width / $size[0];
} else {
$scale = $height / $size[1];
}
// make sure its not smaller to begin with!
if ($width >= $size[0] && $height >= $size[1]){
$scale = 1;
}
$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($size[0] * $scale, $size[1] * $scale);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $size[0] * $scale, $size[1] * $scale, $size[0], $size[1]);
imagejpeg($im_out, $target, $quality);
imagedestroy($im_out);
imagedestroy($im_in);
}
}
$DelFile = $imagename;
if(basename($_FILES['image_file']['name']) == "")
echo "";
else
unlink($DelFile);
$SAVEPNAME = str_replace("'","''",$_REQUEST['PNAME']);
$SAVEPTEXT = str_replace("'","''",$_REQUEST['PTEXT']);
$SAVEPPRICE = str_replace("'","''",$_REQUEST['PPRICE']);
$SAVEPID = str_replace("'","''",$_REQUEST['PID']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
if(basename($_FILES['image_file']['name']) == "")
{
$query = "UPDATE SHOPPRODUCTS SET PNAME = '$SAVEPNAME', PTEXT = '$SAVEPTEXT', PPRICE = '$SAVEPPRICE' WHERE PID = '$SAVEPID'";
}
else
{
$query = "UPDATE SHOPPRODUCTS SET PNAME = '$SAVEPNAME', PTEXT = '$SAVEPTEXT', PPRICE = '$SAVEPPRICE', PIMAGE ='1' WHERE PID = '$SAVEPID'";
}
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
if($_GET["action"] == "addproduct")
{
$GETPNAME = str_replace("'","''",$_REQUEST['PNAME']);
$GETPTEXT = str_replace("'","''",$_REQUEST['PTEXT']);
$GETPPRICE = str_replace("'","''",$_REQUEST['PPRICE']);
$GETPCAT = str_replace("'","''",$_REQUEST['PCAT']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "INSERT INTO SHOPPRODUCTS VALUES ('','$GETPNAME','$GETPTEXT','$GETPPRICE','$GETPCAT','0')";
mysql_query($query);
}
if($_GET["action"] == "editcat")
{
$GETCATNAME2 = str_replace("'","''",$_REQUEST['CATNAME2']);
$GETSHOPCAT2 = str_replace("'","''",$_REQUEST['SHOPID2']);
$GETSOLDOUT2 = str_replace("'","''",$_REQUEST['SOLDOUT2']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "UPDATE SHOPCAT SET CATNAME = '$GETCATNAME2', SOLDOUT = '$GETSOLDOUT2' WHERE SHOPID = '$GETSHOPCAT2'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
?>
<?
if($_GET["action"] == "deleteshopcat")
{
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$TID = $_REQUEST['DID'] ;
$sql = "DELETE FROM SHOPCAT WHERE SHOPID = '$TID'";
mysql_query($sql);
//mysql_close();
}
?>
<?
if($_GET["action"] == "deleteproduct")
{
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$TID = $_REQUEST['DID'] ;
$sql = "DELETE FROM SHOPPRODUCTS WHERE PID = '$TID'";
mysql_query($sql);
//mysql_close();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?echo$SHOWTITLE?></title>
<meta name="description" content="<?echo$SHOWDESC?>" />
<meta name="keywords" content="<?echo$SHOWKEYS?>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<SCRIPT SRC="language-en.js"></SCRIPT>
<SCRIPT SRC="nopcart.js"></SCRIPT>
<script>
function Edit(id)
{
window.open("editor/examples/editor1.php?ID="+id,"test","toolbar=no,location=no,status=no,resizable=yes,scrollbars=auto,width=700,height=600,top=50,left=50");
}
</script>
<script language="JavaScript">
<!--
function Form1()
{
if(document.form2.NAME.value=="")
{
alert("Please Enter Page Name");
return false;
}
}
function Form2()
{
if(document.form3.SUBONENAME.value=="")
{
alert("Please Enter Sub Page Name");
return false;
}
}
function Form3()
{
if(document.form4.SUBTWONAME.value=="")
{
alert("Please Enter Sub Page Name");
return false;
}
}
//-->
</script>
<script>
function DeletePage(id)
{
if(confirm("Are you really really sure you want to delete this page?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?action=delete&DID="+id
}
}
}
</script>
<script>
function DeleteProd(id)
{
if(confirm("Are you really really sure you want to delete this product?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?ID=49&action=deleteproduct&DID="+id
}
}
}
</script>
<script>
function DeleteShopCat(id)
{
if(confirm("Are you really really sure you want to delete this catagoy?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?ID=49&action=deleteshopcat&DID="+id
}
}
}
</script>
<script>
function showit(it) {
document.getElementById(it).style.display = "block";
}
function hideit(it) {
document.getElementById(it).style.display = "none";
}
function hideall() {
for (var i=1; i<=2; i++) {
hideit("x" + i);
}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<style type="text/css">
<!--
body {
background-image: url(back.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/florida.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('images/button1_2.jpg','images/button2_2.jpg')">
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" background="mainback.jpg"><table width="944" height="717" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="109"><div align="right"><img src="images/facebook.jpg" width="310" height="50" border="0" /><br />
<img src="images/button1_1.jpg" name="Image4" border="0" id="Image4" /><img src="images/button2.jpg" width="32" height="59" /><img src="images/button2_1.jpg" name="Image6" width="129" height="59" border="0" id="Image6" /></div></td>
</tr>
<tr>
<td height="159">
</td>
</tr>
<tr>
<td valign="top"><table width="941" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> </td>
<td valign="top" class="TextD"><br /> </td>
</tr>
<tr>
<td width="156" valign="top"><table width="155" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/menuback.jpg"><br />
<table width="156" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="28"> </td>
<td width="128" valign="top"><? include("menu.php");?>
<br />
<br /></td>
</tr>
</table>
<div align="left"><img src="images/menubottom.jpg" width="149" height="69" /><br />
</tr>
</table>
<?php
if ($_SESSION['florida']=='fields321')
{
?>
<div align="left">
<span class="link2"> • Edit Menu</span><br />
<span class="link2"> • Logout</span><br />
<span class="link2"> • Page Settings</span><br />
<span class="link2"> • Sort Menu</span><br />
<span class="link2"> • Members</span><br />
<span class="link2"> • Orders</span><br />
<span class="link2"> • Edit Gallery</span><br />
</div>
<?
}
?>
<span class="link2"> • Shop The Farm</span><br />
</td>
<td width="779" valign="top"><span class="TextB"><strong>SHOPPING CART</strong></span><br />
<br />
<span class="TextB">Members are responsible for all paypal fees. The fee will be listed on your invoice as shipping.</span> <br />
<br />
<FORM ACTION="checkout.php" NAME="form" METHOD="POST" onSubmit="return ValidateCart(this)">
<div align="left">
<script>
ManageCart();
</script>
<input type=IMAGE src="images/placeorder.jpg" alt="Place Order" border=0 /> <img src="images/returntocart.jpg" border="0"/>
</div>
</FORM><br /></td>
</tr>
</table></td>
</tr>
</table>
<br /></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
</body>
</html>

Related

PHP MSSQL Pagination doesn't go to the next page

<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?php
$sql_name = 'test';
$sql_user = 'sa';
$sql_pass = '';
$dbConn = odbc_connect("Driver={SQL Server};Server={$sql_name};",$sql_user,$sql_pass) or die('Database Connection Error!');
if (!$dbConn) {
exit("Connection failed:".odbc_errormsg());
}
$strSQL = "SELECT * FROM test_db.dbo.test ORDER BY ID ASC ";
$objExec = odbc_exec($dbConn, $strSQL) or die ("Error Execute [".$strSQL."]");
$Num_Rows = 0;
while(odbc_fetch_row($objExec))$Num_Rows++; // Count Record
$Per_Page = 22; // Per Page
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page)+1;
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$Page_End = $Per_Page * $Page;
if($Page_End > $Num_Rows)
{
$Page_End = $Num_Rows;
}
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">ID </div></th>
<th width="98"> <div align="center">Name </div></th>
</tr>
<?php
for($i=$Page_Start;$i<=$Page_End;$i++)
{
$objResult = odbc_fetch_array($objExec,$i);
?>
<tr>
<td><div align="center"><?=$objResult["ID"];?></div></td>
<td><?=$objResult["Name"];?></td>
</tr>
<?php
}
?>
</table>
<br>
Total <?php echo $Num_Rows;?> Record : <?php echo $Num_Pages;?> Page :
<?php
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
odbc_close($dbConn);
?>
</body>
</html>
When I press the button to go to the next page or any other page number it stays on the same page but if I change $Page=2; It will go to page 2 and when pressed to go to another page, it will stay at the same page.

checkout.php doesnt capture value from managecart.php

ok here is my issue, this code worked for me before but my server ended up updating php from 5.2 to 5.5 then it all messed up/
soon as i made it back 5.2 it worked again but now my checkout.php wont capture the values from managecart.php
any help would be appreciated.
below = managecart.php code
<?
session_start();
include("includes/db.php");
include("includes/phpscripts.php");
include('includes/settings.php');
if($_GET["action"] == "addcat")
{
$GETCATNAME = str_replace("'","''",$_REQUEST['CATNAME']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "INSERT INTO SHOPCAT VALUES ('','$GETCATNAME','0')";
mysql_query($query);
}
if($_GET["action"] == "editcat")
{
$GETCATNAME2 = str_replace("'","''",$_REQUEST['CATNAME2']);
$GETSHOPCAT2 = str_replace("'","''",$_REQUEST['SHOPID2']);
$GETSOLDOUT2 = str_replace("'","''",$_REQUEST['SOLDOUT2']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "UPDATE SHOPCAT SET CATNAME = '$GETCATNAME2', SOLDOUT = '$GETSOLDOUT2' WHERE SHOPID = '$GETSHOPCAT2'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
if($_GET["action"] == "saveproduct")
{
$SAVEPID = str_replace("'","''",$_REQUEST['PID']);
unset($imagename);
if(!isset($_FILES) && isset($HTTP_POST_FILES))
$_FILES = $HTTP_POST_FILES;
if(!isset($_FILES['image_file']))
$error["image_file"] = "An image was not found.";
$newphrase = $SAVEPID.".jpg";
$imagename = str_replace(" ", "-", $newphrase);
if(empty($imagename))
$error["imagename"] = "The name of the image was not found.";
if(empty($error))
{
$newimage = $imagename;
if(basename($_FILES['image_file']['name']) == "")
{
}
else
{
$result = #move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";
$source = $imagename;
$target = "products/$source";
$width = 200;
$height = 133;
$quality = 100;
$size = getimagesize($source);
//scale evenly
$ratio = $size[0] / $size[1];
if ($ratio >= 1){
$scale = $width / $size[0];
} else {
$scale = $height / $size[1];
}
// make sure its not smaller to begin with!
if ($width >= $size[0] && $height >= $size[1]){
$scale = 1;
}
$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($size[0] * $scale, $size[1] * $scale);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $size[0] * $scale, $size[1] * $scale, $size[0], $size[1]);
imagejpeg($im_out, $target, $quality);
imagedestroy($im_out);
imagedestroy($im_in);
$result = #move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";
$source = $imagename;
$target = "products/large/$source";
$width = 600;
$height = 400;
$quality = 100;
$size = getimagesize($source);
//scale evenly
$ratio = $size[0] / $size[1];
if ($ratio >= 1){
$scale = $width / $size[0];
} else {
$scale = $height / $size[1];
}
// make sure its not smaller to begin with!
if ($width >= $size[0] && $height >= $size[1]){
$scale = 1;
}
$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($size[0] * $scale, $size[1] * $scale);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $size[0] * $scale, $size[1] * $scale, $size[0], $size[1]);
imagejpeg($im_out, $target, $quality);
imagedestroy($im_out);
imagedestroy($im_in);
}
}
$DelFile = $imagename;
if(basename($_FILES['image_file']['name']) == "")
echo "";
else
unlink($DelFile);
$SAVEPNAME = str_replace("'","''",$_REQUEST['PNAME']);
$SAVEPTEXT = str_replace("'","''",$_REQUEST['PTEXT']);
$SAVEPPRICE = str_replace("'","''",$_REQUEST['PPRICE']);
$SAVEPID = str_replace("'","''",$_REQUEST['PID']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
if(basename($_FILES['image_file']['name']) == "")
{
$query = "UPDATE SHOPPRODUCTS SET PNAME = '$SAVEPNAME', PTEXT = '$SAVEPTEXT', PPRICE = '$SAVEPPRICE' WHERE PID = '$SAVEPID'";
}
else
{
$query = "UPDATE SHOPPRODUCTS SET PNAME = '$SAVEPNAME', PTEXT = '$SAVEPTEXT', PPRICE = '$SAVEPPRICE', PIMAGE ='1' WHERE PID = '$SAVEPID'";
}
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
if($_GET["action"] == "addproduct")
{
$GETPNAME = str_replace("'","''",$_REQUEST['PNAME']);
$GETPTEXT = str_replace("'","''",$_REQUEST['PTEXT']);
$GETPPRICE = str_replace("'","''",$_REQUEST['PPRICE']);
$GETPCAT = str_replace("'","''",$_REQUEST['PCAT']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "INSERT INTO SHOPPRODUCTS VALUES ('','$GETPNAME','$GETPTEXT','$GETPPRICE','$GETPCAT','0')";
mysql_query($query);
}
if($_GET["action"] == "editcat")
{
$GETCATNAME2 = str_replace("'","''",$_REQUEST['CATNAME2']);
$GETSHOPCAT2 = str_replace("'","''",$_REQUEST['SHOPID2']);
$GETSOLDOUT2 = str_replace("'","''",$_REQUEST['SOLDOUT2']);
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$query = "UPDATE SHOPCAT SET CATNAME = '$GETCATNAME2', SOLDOUT = '$GETSOLDOUT2' WHERE SHOPID = '$GETSHOPCAT2'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
?>
<?
if($_GET["action"] == "deleteshopcat")
{
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$TID = $_REQUEST['DID'] ;
$sql = "DELETE FROM SHOPCAT WHERE SHOPID = '$TID'";
mysql_query($sql);
//mysql_close();
}
?>
<?
if($_GET["action"] == "deleteproduct")
{
$dbh=mysql_connect ("localhost", "florida_fields", "fields321") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("florida_fields");
$TID = $_REQUEST['DID'] ;
$sql = "DELETE FROM SHOPPRODUCTS WHERE PID = '$TID'";
mysql_query($sql);
//mysql_close();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?echo$SHOWTITLE?></title>
<meta name="description" content="<?echo$SHOWDESC?>" />
<meta name="keywords" content="<?echo$SHOWKEYS?>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<SCRIPT SRC="language-en.js"></SCRIPT>
<SCRIPT SRC="nopcart.js"></SCRIPT>
<script>
function Edit(id)
{
window.open("editor/examples/editor1.php?ID="+id,"test","toolbar=no,location=no,status=no,resizable=yes,scrollbars=auto,width=700,height=600,top=50,left=50");
}
</script>
<script language="JavaScript">
<!--
function Form1()
{
if(document.form2.NAME.value=="")
{
alert("Please Enter Page Name");
return false;
}
}
function Form2()
{
if(document.form3.SUBONENAME.value=="")
{
alert("Please Enter Sub Page Name");
return false;
}
}
function Form3()
{
if(document.form4.SUBTWONAME.value=="")
{
alert("Please Enter Sub Page Name");
return false;
}
}
//-->
</script>
<script>
function DeletePage(id)
{
if(confirm("Are you really really sure you want to delete this page?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?action=delete&DID="+id
}
}
}
</script>
<script>
function DeleteProd(id)
{
if(confirm("Are you really really sure you want to delete this product?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?ID=49&action=deleteproduct&DID="+id
}
}
}
</script>
<script>
function DeleteShopCat(id)
{
if(confirm("Are you really really sure you want to delete this catagoy?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?ID=49&action=deleteshopcat&DID="+id
}
}
}
</script>
<script>
function showit(it) {
document.getElementById(it).style.display = "block";
}
function hideit(it) {
document.getElementById(it).style.display = "none";
}
function hideall() {
for (var i=1; i<=2; i++) {
hideit("x" + i);
}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<style type="text/css">
<!--
body {
background-image: url(back.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/florida.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('images/button1_2.jpg','images/button2_2.jpg')">
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" background="mainback.jpg"><table width="944" height="717" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="109"><div align="right"><img src="images/facebook.jpg" width="310" height="50" border="0" /><br />
<img src="images/button1_1.jpg" name="Image4" border="0" id="Image4" /><img src="images/button2.jpg" width="32" height="59" /><img src="images/button2_1.jpg" name="Image6" width="129" height="59" border="0" id="Image6" /></div></td>
</tr>
<tr>
<td height="159">
</td>
</tr>
<tr>
<td valign="top"><table width="941" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> </td>
<td valign="top" class="TextD"><br /> </td>
</tr>
<tr>
<td width="156" valign="top"><table width="155" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/menuback.jpg"><br />
<table width="156" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="28"> </td>
<td width="128" valign="top"><? include("menu.php");?>
<br />
<br /></td>
</tr>
</table>
<div align="left"><img src="images/menubottom.jpg" width="149" height="69" /><br />
</tr>
</table>
<?php
if ($_SESSION['florida']=='fields321')
{
?>
<div align="left">
<span class="link2"> • Edit Menu</span><br />
<span class="link2"> • Logout</span><br />
<span class="link2"> • Page Settings</span><br />
<span class="link2"> • Sort Menu</span><br />
<span class="link2"> • Members</span><br />
<span class="link2"> • Orders</span><br />
<span class="link2"> • Edit Gallery</span><br />
</div>
<?
}
?>
<span class="link2"> • Shop The Farm</span><br />
</td>
<td width="779" valign="top"><span class="TextB"><strong>SHOPPING CART</strong></span><br />
<br />
<span class="TextB">Members are responsible for all paypal fees. The fee will be listed on your invoice as shipping.</span> <br />
<br />
<FORM ACTION="checkout.php" NAME="form" METHOD="GET" onSubmit="return ValidateCart(this)">
<div align="left">
<script>
ManageCart();
</script>
<input type=IMAGE src="images/placeorder.jpg" alt="Place Order" border=0 /> <img src="images/returntocart.jpg" border="0"/>
</div>
</FORM><br /></td>
</tr>
</table></td>
</tr>
</table>
<br /></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
</body>
</html>
below = checkout.php code
<?
session_start();
?>
<?
$strMessageBody .= "$QUANTITY_1 - \$$PRICE_1 - $NAME_1 <br>";
if( $NAME_2 ) {$strMessageBody .= "$QUANTITY_2 - \$$PRICE_2 - $NAME_2 <br>";}
if( $NAME_3 ) {$strMessageBody .= "$QUANTITY_3 - \$$PRICE_3 - $NAME_3 <br>";}
if( $NAME_4 ) {$strMessageBody .= "$QUANTITY_4 - \$$PRICE_4 - $NAME_4 <br>";}
if( $NAME_5 ) {$strMessageBody .= "$QUANTITY_5 - \$$PRICE_5 - $NAME_5 <br>";}
if( $NAME_6 ) {$strMessageBody .= "$QUANTITY_6 - \$$PRICE_6 - $NAME_6 <br>";}
if( $NAME_7 ) {$strMessageBody .= "$QUANTITY_7 - \$$PRICE_7 - $NAME_7 <br>";}
if( $NAME_8 ) {$strMessageBody .= "$QUANTITY_8 - \$$PRICE_8 - $NAME_8 <br>";}
if( $NAME_9 ) {$strMessageBody .= "$QUANTITY_9 - \$$PRICE_9 - $NAME_9 <br>";}
if( $NAME_10 ){$strMessageBody .= "$QUANTITY_10 - \$$PRICE_10 - $NAME_10 <br>";}
if( $NAME_11 ){$strMessageBody .= "$QUANTITY_11 - \$$PRICE_11 - $NAME_11 <br>";}
if( $NAME_12 ){$strMessageBody .= "$QUANTITY_12 - \$$PRICE_12 - $NAME_12 <br>";}
if( $NAME_13 ){$strMessageBody .= "$QUANTITY_13 - \$$PRICE_13 - $NAME_13 <br>";}
if( $NAME_14 ){$strMessageBody .= "$QUANTITY_14 - \$$PRICE_14 - $NAME_14 <br>";}
if( $NAME_15 ){$strMessageBody .= "$QUANTITY_15 - \$$PRICE_15 - $NAME_15 <br>";}
if( $NAME_16 ){$strMessageBody .= "$QUANTITY_16 - \$$PRICE_16 - $NAME_16 <br>";}
if( $NAME_17 ){$strMessageBody .= "$QUANTITY_17 - \$$PRICE_17 - $NAME_17 <br>";}
if( $NAME_18 ){$strMessageBody .= "$QUANTITY_18 - \$$PRICE_18 - $NAME_18 <br>";}
if( $NAME_19 ){$strMessageBody .= "$QUANTITY_19 - \$$PRICE_19 - $NAME_19 <br>";}
if( $NAME_20 ){$strMessageBody .= "$QUANTITY_20 - \$$PRICE_20 - $NAME_20 <br>";}
if( $NAME_21 ){$strMessageBody .= "$QUANTITY_21 - \$$PRICE_21 - $NAME_21 <br>";}
if( $NAME_22 ){$strMessageBody .= "$QUANTITY_22 - \$$PRICE_22 - $NAME_22 <br>";}
if( $NAME_23 ){$strMessageBody .= "$QUANTITY_23 - \$$PRICE_23 - $NAME_23 <br>";}
if( $NAME_24 ){$strMessageBody .= "$QUANTITY_24 - \$$PRICE_24 - $NAME_24 <br>";}
if( $NAME_25 ){$strMessageBody .= "$QUANTITY_25 - \$$PRICE_25 - $NAME_25 <br>";}
if( $NAME_26 ){$strMessageBody .= "$QUANTITY_26 - \$$PRICE_26 - $NAME_26 <br>";}
if( $NAME_27 ){$strMessageBody .= "$QUANTITY_27 - \$$PRICE_27 - $NAME_27 <br>";}
if( $NAME_28 ){$strMessageBody .= "$QUANTITY_28 - \$$PRICE_28 - $NAME_28 <br>";}
$wcart = $strMessageBody;
$strMessageBody2 .= "$TOTAL";
$wcart = $strMessageBody;
$wtotal = $strMessageBody2;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Florida Fields To Forks</title>
<meta name="description" content="<?echo$SHOWDESC?>" />
<meta name="keywords" content="<?echo$SHOWKEYS?>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<SCRIPT SRC="language-en.js"></SCRIPT>
<SCRIPT SRC="nopcart.js"></SCRIPT>
<script>
function Edit(id)
{
window.open("editor/examples/editor1.php?ID="+id,"test","toolbar=no,location=no,status=no,resizable=yes,scrollbars=auto,width=700,height=600,top=50,left=50");
}
</script>
<script language="JavaScript">
<!--
function Form1()
{
if(document.form2.NAME.value=="")
{
alert("Please Enter Page Name");
return false;
}
}
function Form2()
{
if(document.form3.SUBONENAME.value=="")
{
alert("Please Enter Sub Page Name");
return false;
}
}
function Form3()
{
if(document.form4.SUBTWONAME.value=="")
{
alert("Please Enter Sub Page Name");
return false;
}
}
function checkoutone()
{
if(document.forma.PICKUP1.value=="")
{
alert("Please Enter Pick-up Date");
return false;
}
}
function checkouttwo()
{
if(document.formb.PICKUP1.value=="")
{
alert("Please Enter Pick-up Date");
return false;
}
}
//-->
</script>
<script>
function DeletePage(id)
{
if(confirm("Are you really really sure you want to delete this page?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?action=delete&DID="+id
}
}
}
</script>
<script>
function DeleteProd(id)
{
if(confirm("Are you really really sure you want to delete this product?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?ID=49&action=deleteproduct&DID="+id
}
}
}
</script>
<script>
function DeleteShopCat(id)
{
if(confirm("Are you really really sure you want to delete this catagoy?"))
{
if(confirm("Ok, don't tell me I didn't warn you! You can not undo this one you know?"))
{
parent.location="index.php?ID=49&action=deleteshopcat&DID="+id
}
}
}
</script>
<script>
function showit(it) {
document.getElementById(it).style.display = "block";
}
function hideit(it) {
document.getElementById(it).style.display = "none";
}
function hideall() {
for (var i=1; i<=2; i++) {
hideit("x" + i);
}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>
<style type="text/css">
<!--
body {
background-image: url(back.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/florida.css" rel="stylesheet" type="text/css" />
</head>
<?
$GETMYTOTAL = $SHOWMEQ;
?>
<body onload="MM_preloadImages('images/button1_2.jpg','images/button2_2.jpg')">
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" background="mainback.jpg"><table width="944" height="717" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="109"><div align="right"><img src="images/facebook.jpg" width="310" height="50" border="0" /><br />
<img src="images/button1_1.jpg" name="Image4" border="0" id="Image4" /><img src="images/button2.jpg" width="32" height="59" /><img src="images/button2_1.jpg" name="Image6" width="129" height="59" border="0" id="Image6" /></div></td>
</tr>
<tr>
<td height="159">
</td>
</tr>
<tr>
<td valign="top"><table width="941" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> </td>
<td valign="top" class="TextD"><br /> </td>
</tr>
<tr>
<td width="156" valign="top"><table width="155" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/menuback.jpg"><br />
<table width="156" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="28"> </td>
<td width="128" valign="top"><? include("menu.php");?>
<br />
<br /></td>
</tr>
</table>
<div align="left"><img src="images/menubottom.jpg" width="149" height="69" /><br />
</tr>
</table>
<?php
if ($_SESSION['florida']=='fields321')
{
?>
<span class="link2"> • Edit Menu</span><br />
<span class="link2"> • Logout</span><br />
<span class="link2"> • Page Settings</span><br />
<span class="link2"> • Sort Menu</span><br />
<span class="link2"> • Members</span><br />
<?
}
?>
<span class="link2"> • View Cart</span><br />
<span class="link2"> • Shop The Farm</span><br />
</td>
<td width="779" valign="top"><span class="TextC">Please review your order and select payment method below.<br>
Please be sure to submit a Pick Up Date thank you. <br />
</span><br />
<br />
View available dates<br />
<br />
<span class="TextB"><?echo$wcart?></span><br />
<table width="486" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form id="forma" name="forma" method="post" action="checkout_check.php" onSubmit="return checkoutone();">
<span class="TextA">Pick-up date:</span>
<input name="PICKUP1" type="text" class="TextA" id="PICKUP1" size="20" />
<span class="TextA">Comments:</span>
<input name="COMMENTS1" type="text" class="TextA" id="COMMENTS1" size="20" />
<input type="hidden" name="memberid" value="<?echo$_SESSION['memberid']?>">
<input type="hidden" name="cart" value="<?echo$wcart?>">
<input type="hidden" name="amount" value="<?echo$SHOWMEQ?>">
<label>
<input name="button" type="submit" class="TextB" id="button" value="Pay by Check" />
</label>
</form></td>
<td><form id="formb" name="formb" method="post" action="checkout_paypal.php" onSubmit="return checkouttwo();">
<span class="TextA">Pick-up date:</span>
<input name="PICKUP1" type="text" class="TextA" id="PICKUP1" size="20" />
<span class="TextA">Comments:</span>
<input name="COMMENTS1" type="text" class="TextA" id="COMMENTS1" size="20" />
<input type="hidden" name="memberid" value="<?echo$_SESSION['memberid']?>">
<input type="hidden" name="cart" value="<?echo$wcart?>">
<input type="hidden" name="amount" value="<?echo$SHOWMEQ?>">
If you use globals, then now as they don't exist, you need to carry those variables around in different way, as function's parameters or $_SESSION variables

Unable to filter data from mysql

I tried to read data of my MySQL database, I created the fullcalendar and show up the event on calendar. However, it is unable to retrieve the data from my MySQL database.
The First php code :
<?php require_once('conn.php'); ?>
<?php $maxRows_RsCourse = 1000000;
$pageNum_RsCourse = 0;
if (isset($_GET['pageNum_RsCourse'])) {
$pageNum_RsCourse = $_GET['pageNum_RsCourse'];
}
$startRow_RsCourse = $pageNum_RsCourse * $maxRows_RsCourse;
mysql_select_db($database_conn, $conn);
$query_RsCourse = "SELECT * FROM tbl_course ORDER BY tcid ASC";
$query_limit_RsCourse = sprintf("%s LIMIT %d, %d", $query_RsCourse, $startRow_RsCourse, $maxRows_RsCourse);
$RsCourse = mysql_query($query_limit_RsCourse, $conn) or die(mysql_error());
$row_RsCourse = mysql_fetch_assoc($RsCourse);
if (isset($_GET['totalRows_RsCourse'])) {
$totalRows_RsCourse = $_GET['totalRows_RsCourse'];
} else {
$all_RsCourse = mysql_query($query_RsCourse);
$totalRows_RsCourse = mysql_num_rows($all_RsCourse);
}
$totalPages_RsCourse = ceil($totalRows_RsCourse/$maxRows_RsCourse)-1;
?>
<?php
$tbl_name="tbl_course"; // Table name
$totalcount = 0;
// Connect to server and select database.
mysql_connect("$hostname_conn", "$username_conn", "$password_conn")or die("cannot connect server ");
mysql_select_db("$database_conn")or die("unable to connect");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
// echo "<table><tr>";
// echo "<td>" . $rows['id'] . "</td><td>" . $rows['title'] . "</td><td>" . $rows['start'] . "</td><td>" . $rows['end'] . "</td><td>" . $rows['url'] . "</td><td>" . $rows['allDay'];
// echo "</td></tr></table>";
$event[$totalcount]['tcid']=$rows['tcid'];
$event[$totalcount]['courseid']=$rows['courseid'];
$event[$totalcount]['coursename']=$rows['coursename'];
$event[$totalcount]['startdate']=$rows['startdate'];
$event[$totalcount]['starttime']=$rows['starttime'];
$event[$totalcount]['enddate']=$rows['enddate'];
$event[$totalcount]['endtime']=$rows['endtime'];
$event[$totalcount]['allday']=$rows['allday'];
$totalcount++;
}
for ($i=0; $i < $totalcount; $i++)
{
$tmp1 = explode("-",$event[$i]['startdate']);
$tmp2 = explode(":",$event[$i]['starttime']);
// 0 = hour, 1 = minutes, 2 = seconds,
$x = 0;
foreach ($tmp1 as $date_values_1)
{
$event_start_date[$i][$x] = $date_values_1;
$x++;
}
$y = 0;
foreach ($tmp2 as $time_values_1)
{
$event_start_time[$i][$y] = $time_values_1;
$y++;
}
$tmp3 = explode("-",$event[$i]['enddate']);
$tmp4 = explode(":",$event[$i]['endtime']);
$a = 0;
foreach ($tmp3 as $date_values_2)
{
$event_end_date[$i][$a] = $date_values_2;
$a++;
}
$b = 0;
foreach ($tmp4 as $time_values_2)
{
$event_end_time[$i][$b] = $time_values_2;
$b++;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0046)http://localhost/calendar/demos/db_display.php -->
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<link href='css/fullcalendar.css' rel='stylesheet' />
<script src='js/jquery-1.9.1.min.js'></script>
<script src='js/jquery-ui-1.10.2.custom.min.js'></script>
<script src='js/fullcalendar.min.js'></script>
<SCRIPT>
$(document).ready(function() {
var start_year = new Array(<?php $totalcount?>);
var start_month = new Array(<?php $totalcount?>);
var start_day = new Array(<?php $totalcount?>);
var end_year =new Array(<?php $totalcount?>);
var end_month =new Array(<?php $totalcount?>);
var end_day =new Array(<?php $totalcount?>);
var start_hour =new Array(<?php $totalcount?>);
var start_mins =new Array(<?php $totalcount?>);
var end_hour =new Array(<?php $totalcount?>);
var end_mins =new Array(<?php $totalcount?>);
<?php
$k = 0;
for ($k=0; $k < $totalcount; $k++) {?>
start_year[<?php echo $k?>] =<?php echo $event_start_date[$k][0] ?>;
start_month[<?php echo $k?>] =<?php echo $event_start_date[$k][1] ?>;
start_day[<?php echo $k?>] =<?php echo $event_start_date[$k][2]?>;
end_year[<?php echo $k?>] =<?php echo $event_end_date[$k][0]?>;
end_month[<?php echo $k?>] =<?php echo $event_end_date[$k][1]?>;
end_day[<?php echo $k?>] =<?php echo $event_end_date[$k][2]?>;
start_hour[<?php echo $k?>] =<?php echo $event_start_time[$k][0] ?>;
start_mins[<?php echo $k?>] =<?php echo $event_start_time[$k][1] ?>;
end_hour[<?php echo $k?>] =<?php echo $event_end_time[$k][0]?>;
end_mins[<?php echo $k?>] =<?php echo $event_end_time[$k][1]?>;
<?php } ?>
var calendar = $('#calendar').fullCalendar({
editable: false,
events: [
<?php $j = 0;
for ($j=0; $j < $totalcount; $j++)
{
?>
<?php
if ($event[$j]['allday'] == 0){?>
{ title: '<?php echo $event[$j]['courseid'];?> <?php echo $event[$j]['coursename'];?>',
start: new Date(start_year[<?php echo $j?>],start_month[<?php echo $j?>]-1,start_day[<?php echo $j?>],start_hour[<?php echo $j?>],start_mins[<?php echo $j?>]),
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]) , url: 'mg_course.php?courseid=<?php echo $event[$j]['courseid']; ?>'
/*
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]) , url: 'mg_course.php?courseid=<?php echo $_GET['courseid']; ?>'
*/
},
<?php } ?>
<?php if ($event[$j]['allday'] == 1) {?>
{ title: '<?php echo $event[$j]['courseid'];?> <?php echo $event[$j]['coursename'];?>',
start: new Date(start_year[<?php echo $j?>],start_month[<?php echo $j?>]-1,start_day[<?php echo $j?>],start_hour[<?php echo $j?>],start_mins[<?php echo $j?>]),
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]), url: 'mg_course.php?courseid=<?php echo $event[$j]['courseid']; ?>',
/*
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]), url: 'mg_course.php?courseid=<?php echo $_GET['courseid']; ?>',
*/
allDay: 'false'
},
<?php } ?>
<?php }?>
{}
]
});
});
</SCRIPT>
<STYLE>BODY {
TEXT-ALIGN: center; MARGIN-TOP: 40px; FONT-FAMILY: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; FONT-SIZE: 14px
}
#calendar {
MARGIN: 0px auto; WIDTH: 900px
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.19412"></HEAD>
<BODY>
<DIV id=calendar></DIV></BODY></HTML>
Here is display event details php:
<?php require_once('conn.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
?>
<?php
$totalRows_RsEnrol = 0;
if ( isset($_POST['courseid']) ) {
$_GET['courseid'] = $_POST['courseid'];
$_GET['courseid'] = $_GET['courseid'] * 1;
if (is_integer($_GET['courseid']) ) {
$maxRows_RsEnrol = 10000;
$pageNum_RsEnrol = 0;
if (isset($_GET['pageNum_RsEnrol'])) {
$pageNum_RsEnrol = $_GET['pageNum_RsEnrol'];
}
$startRow_RsEnrol = $pageNum_RsEnrol * $maxRows_RsEnrol;
mysql_select_db($database_conn, $conn);
$query_RsEnrol = "SELECT * FROM 'tbl_enroll' WHERE 'tbl_enroll'.'courseid' = '".$_GET['courseid']."'";
//$query_RsEnrol = sprintf("SELECT erid, courseid, staffid FROM tbl_enroll WHERE courseid = %s ORDER BY staffid ASC", $_GET['courseid']);
$query_limit_RsEnrol = sprintf("%s LIMIT %d, %d", $query_RsEnrol, $startRow_RsEnrol, $maxRows_RsEnrol);
$RsEnrol = mysql_query($query_limit_RsEnrol, $conn) or die(mysql_error());
$row_RsEnrol = mysql_fetch_assoc($RsEnrol);
if (isset($_GET['totalRows_RsEnrol'])) {
$totalRows_RsEnrol = $_GET['totalRows_RsEnrol'];
} else {
$all_RsEnrol = mysql_query($query_RsEnrol);
$totalRows_RsEnrol = mysql_num_rows($all_RsEnrol);
}
$totalPages_RsEnrol = ceil($totalRows_RsEnrol/$maxRows_RsEnrol)-1;
} else { $totalRows_RsEnrol = 0;}
}
/******************************************************************************************************/
elseif (isset($_GET['courseid']) && !empty($_GET['courseid']) ) {
$_GET['courseid'] = $_GET['courseid']*1;
if (is_integer($_GET['courseid'])){
$maxRows_RsEnrol = 1000000;
$pageNum_RsEnrol = 0;
if (isset($_GET['pageNum_RsEnrol'])) {
$pageNum_RsEnrol = $_GET['pageNum_RsEnrol'];
}
$startRow_RsEnrol = $pageNum_RsEnrol * $maxRows_RsEnrol;
mysql_select_db($database_conn, $conn);
$query_RsEnrol = sprintf("SELECT * FROM tbl_enroll WHERE courseid IN ( SELECT courseid FROM tbl_course WHERE courseid = %s) ORDER BY erid ASC", $_GET['courseid']);
//$query_RsEnrol = sprintf("SELECT erid, courseid, staffid FROM tbl_enroll WHERE courseid=%s ORDER BY staffid ASC", $_GET['courseid']);
$query_limit_RsEnrol = sprintf("%s LIMIT %d, %d", $query_RsEnrol, $startRow_RsEnrol, $maxRows_RsEnrol);
$RsEnrol = mysql_query($query_limit_RsEnrol, $conn) or die(mysql_error());
$row_RsEnrol = mysql_fetch_assoc($RsEnrol);
if (isset($_GET['totalRows_RsEnrol'])) {
$totalRows_RsEnrol = $_GET['totalRows_RsEnrol'];
} else {
$all_RsEnrol = mysql_query($query_RsEnrol);
$totalRows_RsEnrol = mysql_num_rows($all_RsEnrol);
}
$totalPages_RsEnrol = ceil($totalRows_RsEnrol/$maxRows_RsEnrol)-1;
} else {$totalRows_RsEnrol=0;}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link href="../../css/style_new.css" rel="stylesheet" type="text/css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<br />
<table width="322" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="171"><img src="../../Images/logo.gif" width="144" height="34"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center" ><h2>Training Program</h2></td>
</tr>
</table>
<div class="containers" align=">
<div class="header">
<p align="center" class="style2">Enrolment</p>
<h5 class="../css/new_style.css" align="left">
<table align="center" width="116%" border="0" cellpadding="0" cellspacing="2" >
<tr align="center" bgcolor="#CCCCCC" >
<td width="16%">Enrolment ID</td>
<td width="50%">Course ID</td>
<td width="14%">Staff ID</td>
<td width="10%"> </td>
<td width="10%"> </td>
</tr>
<tr align="center" bgcolor="#dfdfdf" >
<td><?php echo $row_RsEnrol['erid']; ?></td>
<td align="left"> <?php echo $row_RsEnrol['courseid']; ?></td>
<td><?php echo $row_RsEnrol['staffid']; ?></td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
It is unable to filter data on Calendar.
I am really appreciated for your help.

Issues with Pagination in PHP

Currently I've 2 tables and have the datas are dynamic.
I need to add pagination for both tables seperately. I had added paginator using paginator class and it is working fine. But the problem is when I click on the next button of the first table then the contents of both tables are changed in to the next page.
Paginator.php
<?php
// Paginator Class
// error_reporting(E_ALL);
define("QS_VAR", "page"); // the variable name inside the query string (don't use this name inside other links)
define("STR_FWD", "Next>>"); // the string is used for a link (step forward)
define("STR_BWD", "<<Prev"); // the string is used for a link (step backward)
$scriptname = (isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '');
define("SCRIPT_NAME", $scriptname);
$v = (isset($_REQUEST['page_num_rows']) ? (is_numeric($_REQUEST['page_num_rows']) ? $_REQUEST['page_num_rows'] : 5) : 5);
define("NUM_ROWS", $v); // the number of records on each page
class Paginator {
var $sql;
var $result;
var $get_var = QS_VAR;
var $rows_on_page = NUM_ROWS;
var $str_forward = STR_FWD;
var $str_backward = STR_BWD;
var $all_rows;
var $num_rows;
var $page;
var $number_pages;
var $url_name = SCRIPT_NAME;
// constructor
function Paginator() {
}
// sets the current page number
function set_page() {
$this->page = (isset($_REQUEST[$this->get_var]) && $_REQUEST[$this->get_var] != "") ? $_REQUEST[$this->get_var] : 0;
return $this->page;
}
// gets the total number of records
function get_total_rows() {
$tmp_result = mysql_query($this->sql);
$this->all_rows = mysql_num_rows($tmp_result);
mysql_free_result($tmp_result);
return $this->all_rows;
}
// get the totale number of result pages
function get_num_pages() {
$this->number_pages = ceil($this->get_total_rows() / $this->rows_on_page);
return $this->number_pages;
}
// returns the records for the current page
function get_page_result() {
$start = $this->set_page() * $this->rows_on_page;
$page_sql = sprintf("%s LIMIT %s, %s", $this->sql, $start, $this->rows_on_page);
$this->result = mysql_query($page_sql);
return $this->result;
}
// get the number of rows on the current page
function get_page_num_rows() {
$this->num_rows = #mysql_num_rows($this->result);
return $this->num_rows;
}
// free the database result
function free_page_result() {
#mysql_free_result($this->result);
}
function display_row_count() {
$var = $this->get_var;
$url_part1 = $this->url_name . "?";
$url_part2 = "&" . $var . "=0" . $this->rebuild_qs($var);
$select = " Show ";
$select.="<form method=get name=page_num_rows_form action=\"$this->url_name\" >"; // [form used for javascript disabled case] -not working
$select.="<select name=page_num_rows id=page_num_rows onChange=\"window.location='$url_part1'+'page_num_rows='+this.value+'$url_part2'\" >";
$select.="<option value=50 " . (isset($_REQUEST['page_num_rows']) ? ($_REQUEST['page_num_rows'] == 50 ? ' selected ' : '') : '') . " >50</option>";
$select.="<option value=100 " . (isset($_REQUEST['page_num_rows']) ? ($_REQUEST['page_num_rows'] == 100 ? ' selected ' : '') : '') . " >100</option>";
$select.="<option value=150 " . (isset($_REQUEST['page_num_rows']) ? ($_REQUEST['page_num_rows'] == 150 ? ' selected ' : '') : '') . " >150</option>";
$select.="<option value=200 " . (isset($_REQUEST['page_num_rows']) ? ($_REQUEST['page_num_rows'] == 200 ? ' selected ' : '') : '') . " >200</option>";
$select.="<option value=500 " . (isset($_REQUEST['page_num_rows']) ? ($_REQUEST['page_num_rows'] == 500 ? ' selected ' : '') : '') . " >500</option>";
$select.="</select>";
$select.="<noscript> <input type=submit value=Go /></noscript>";
$select.="</form>"; // form used for javascript disabled case -- not working
$select.=" per page";
return $select;
}
// function to handle other querystring than the page variable
function rebuild_qs($curr_var) {
if (!empty($_SERVER['QUERY_STRING'])) {
$parts = explode("&", $_SERVER['QUERY_STRING']);
$newParts = array();
foreach ($parts as $val) {
if (stristr($val, $curr_var) == false) {
array_push($newParts, $val);
}
}
if (count($newParts) != 0) {
$qs = "&" . implode("&", $newParts);
} else {
return false;
}
return $qs; // this is your new created query string
} else {
return false;
}
}
// this method will return the navigation links for the conplete recordset
function navigation($separator = " | ", $css_current = "", $back_forward = false) {
$max_links = NUM_LINKS;
$curr_pages = $this->set_page();
$all_pages = $this->get_num_pages() - 1;
$var = $this->get_var;
$navi_string = "";
if (!$back_forward) {
$max_links = ($max_links < 2) ? 2 : $max_links;
}
if ($curr_pages <= $all_pages && $curr_pages >= 0) {
if ($curr_pages > ceil($max_links / 2)) {
$start = ($curr_pages - ceil($max_links / 2) > 0) ? $curr_pages - ceil($max_links / 2) : 1;
$end = $curr_pages + ceil($max_links / 2);
if ($end >= $all_pages) {
$end = $all_pages + 1;
$start = ($all_pages - ($max_links - 1) > 0) ? $all_pages - ($max_links - 1) : 1;
}
} else {
$start = 0;
$end = ($all_pages >= $max_links) ? $max_links : $all_pages + 1;
}
if ($all_pages >= 1) {
$forward = $curr_pages + 1;
$backward = $curr_pages - 1;
$navi_string = ($curr_pages > 0) ? "" . $this->str_first . " " . $this->str_backward . " " : $this->str_first . " " . $this->str_backward . " ";
$navi_string .= ($curr_pages < $all_pages) ? " " . $this->str_forward . "" . " " : " " . $this->str_forward . " ";
}
}
return "<span style='font-size:.7em; padding:3px 3px 4px 3px;'>" . $this->current_page_info() . $navi_string . "</span>";
}
function current_page_info() {
$cur_page = $this->set_page() + 1;
$total_pages = $this->get_num_pages();
// $page_info = " Page " . $cur_page . " of " . $total_pages . " ";
// return $page_info;
}
function show_go_to_page() {
$cur_page = $this->set_page() + 1;
$total_pages = $this->get_num_pages();
$options = "";
for ($i = 1; $i <= $total_pages; $i++) {
$options.="<option value=$i " . (($i == $cur_page) ? ' selected ' : '') . ">$i</option>";
}
$page_info = " Go to page <input type=text name=paginator_go_to_page id=paginator_go_to_page size=1 value=$cur_page />";
// $page_info.= "<select name=paginator_go_to_page2 >$options</select>";
return $page_info;
}
}
?>
tables.php
<?php
include("library/paginator.php");
?>
<div style="text-align:right;">
<?
$query = "select * from haves_settings";
$tab = mysql_query($query);
$row = mysql_fetch_array($tab);
$item_no = $row['items_to_show'];
$scroll = $row['scroll_interval'];
$online_paginate = new Paginator;
$online_paginate->sql = "select * from placing_item_bid where status='Active' and picture1!='' and selling_method!='want_it_now' and selling_method!='ads' and bid_starting_date <= now() and expire_date>=now() order by item_id desc"; // sql statement
$online_paginate->rows_on_page = $item_no;
$results = $online_paginate->get_page_result(); // result set
$num_rows = $online_paginate->get_page_num_rows(); // number of records in result set
$nav_links = $online_paginate->navigation(" | "); // the navigation links (define a CSS class
?>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#d79196" class="detail9txt">
<input type="hidden" value="2" name="len">
<td align="center" width="20%"><b>Picture</b> </td>
<td width="30%" align="center"><b>Name / Responses</b> </td>
<td width="50%" align="center"><b>Description</b> </td>
</tr><tr style="height:10px;"><td></td></tr>
<?
if ($num_rows > 0) {
while ($bestsellers_fetch = mysql_fetch_array($results)) {
$temp = $bestsellers_fetch['item_id'];
$sql = "SELECT count(`user_id`) as response FROM `watch_list` where `item_id`=$temp group by `item_id`";
$res = mysql_query($sql);
$response = mysql_fetch_row($res);
$counttop = $counttop + 1;
if (!empty($bestsellers_fetch['sub_title']))
$item_subtitle1 = $bestsellers_fetch['sub_title'];
else
$item_subtitle1 = substr($bestsellers_fetch['item_title'], 0, 20);
$item_title1 = substr($bestsellers_fetch['item_title'], 0, 40)
?>
<tr>
<td class="tr_botborder" style="vertical-align:middle;" width="20%" align="center"><div align="center"><img src="thumbnail/<?= $bestsellers_fetch['picture1']; ?>" alt="" width="79" height="70" border="0" /></div></td>
<td class="tr_botborder" style="vertical-align:middle;" width="30%" align="center"><div align="center"><span class="bestsellerstxt"><?= $item_subtitle1; ?> <?= $item_title1; ?><br/><?php if ($response[0] != '') { ?><a style="text-decoration:none;color:#336666;" href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>"> <?php echo $response[0] . ' responses'; ?></a> <?php } else { ?><span style="color:#666666;"><?php
echo '0 responses';
}
?></span></span></td>
<td class="tr_botborder" style="vertical-align:middle;" width="50%" align="center"><div align="center"><span class="bestsellerstxt"><?= html_entity_decode($bestsellers_fetch['detailed_descrip']); ?></span></td>
</tr>
<?
if ($counttop != 2) {
}
}
} else {
?>
<tr><td height="148" align="center" class="featxt">No Items Available</td></tr>
<?
}
?>
</table>
<div style="text-align: right;"><?php echo $nav_links; ?></div>
//wants content
$online_paginate1 = new Paginator;
$online_paginate1->sql = "select * from placing_item_bid where status='Active' and selling_method='want_it_now' order by item_id desc";
$online_paginate1->rows_on_page = $item_no1;
$result1 = $online_paginate1->get_page_result(); // result set
$want_total_records = $online_paginate1->get_page_num_rows(); // number of records in result set
$nav_links1 = $online_paginate1->navigation(" | "); // the navigation links (define a CSS class
?>
<div class="superbg">
<table cellspacing="0" cellpadding="5" width=100%>
<form name="want_form" action="myauction.php" method=post>
<tr bgcolor="#d79196" class="detail9txt">
<input type="hidden" name="len" value="<?= $want_total_records ?>">
<td align="center" width="30%"><b>Name / Responses</b> </td>
<td align="center" width="20%"><b>Picture</b> </td>
<td width="50%" align="center"><b>Description</b> </td>
</tr>
<?
if ($want_total_records > 0) {
while ($want_row = mysql_fetch_array($result1)) {
$tot_bid_sql = "select count(*) from want_it_now where wanted_itemid=" . $want_row[item_id];
$tot_bid_res = mysql_query($tot_bid_sql);
$tot_bids = mysql_fetch_array($tot_bid_res);
?>
<tr class="detail9txt">
<td class="tr_botborder" align="center" style="vertical-align:middle;" width="30%">
<a href="wantitnowdes.php?item_id=<?= $want_row['item_id'] ?>" class="header_text">
<? echo $want_row['item_title']; ?></a> <br/> <?
if ($tot_bids[0] != 0) {
?>
<a style="font-weight:normal;" href="wantitnowdes.php?item_id=<?= $want_row['item_id'] ?> " class="header_text"><? echo $tot_bids[0] . ' responses'; ?></a>
<?
} else {
echo $tot_bids[0] . ' responses';
}
?></td>
<td class="tr_botborder" style="vertical-align:middle;" width="20%" align="center">
<?
if (!empty($want_row['picture1'])) {
$img = $want_row['picture1'];
list($width, $height, $type, $attr) = getimagesize("images/$img");
$h = $height;
$w = $width;
if ($h > 50) {
$nh = 50;
$nw = ($w / $h) * $nh;
$h = $nh;
$w = $nw;
}
if ($w > 50) {
$nw = 50;
$nh = ($h / $w) * $nw;
$h = $nh;
$w = $nw;
}
?>
<!-- <img name="runimg" src="images/<? //echo $want_row['picture1']; ?>" border=1 width=<? //= $w; ?> height=<? //=$h ?> >-->
<img name="runimg" src="images/<? echo $want_row['picture1']; ?>" border=1 width="79" height="70" >
<?
} else {
?>
<img src="images/no_image.gif" border=1 name="runimg" >
<? } ?>
</td>
<td class="tr_botborder" style="vertical-align:middle;" width="50%" align="center"><div align="center"><span class="bestsellerstxt"><?= html_entity_decode($want_row['detailed_descrip']); ?></span></td>
</tr>
<?
} // while
} else {
?>
<tr>
<td width="3%"> </td>
<td width="97%" class="myauction3txt">There are no items in this section</td>
</tr>
<? } ?>
</table>
<div style="text-align: right;"><?php echo $nav_links1; ?></div>
</div>
Where is the problem ?
Paginator class uses the same query string "page" parameter to calculate the current page. If you add 2 or more Pagination in the same request, "page" will be shared by all instances, leading to this mess you described.
How to fix it ?
Tell the Paginator class which parameter to use in query string... follow this 2-step patch below :
Step 1 : replace constructor in Paginator class
// constructor
function Paginator($get_var=null) {
if ($get_var!=null) $this->get_var = $get_var;
}
Step 2 : update Paginator object creation (twice)
$online_paginate = new Paginator('page_table1');
and later :
$online_paginate1 = new Paginator('page_table2');
Hope this helps !

Add fields to event display form

I am using an open source calendar to display events, I am having a trouble to add extra fields to event display form. Could anyone please indicate where I need to add code so more fields can be displayed.
Please could anyone kindly help me.
Many Thanks.
Here is the code for displaying the events:
<?php
require("config.php");
require("./lang/lang." . LANGUAGE_CODE . ".php");
require("functions.php");
$auth = auth();
$id = $_GET['id'];
mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME) or die(mysql_error());
$sql = "SELECT d, m, y FROM " . DB_TABLE_PREFIX . "mssgs WHERE id=" . $id;
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
$d = $row["d"];
$m = $row["m"];
$y = $row["y"];
$dateline = $lang['months'][$m-1] . " $d, $y";
$wday = date("w", mktime(0,0,0,$m,$d,$y));
writeHeader($m, $y, $dateline, $wday, $auth);
// display selected posting first
writePosting($id, $auth);
// give some space
echo '<img src="images/clear.gif" width="1" height="25" border="0"><br clear="all">';
// query for rest of this day's postings
$sql = "SELECT id, start_time FROM " . DB_TABLE_PREFIX . "mssgs ";
$sql .= "WHERE y = " . $y . " AND m = " . $m . " AND d = " . $d . " AND id != $id ";
$sql .= "ORDER BY start_time ASC";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result)) {
echo '<span class="display_header">' . $lang['otheritems'] . '</span>';
echo '<br clear="all"><img src="/images/clear.gif" width="1" height="3" border="0"><br clear="all">';
// display rest of this day's postings
while ($row = mysql_fetch_array($result)) {
writePosting($row[0], $auth);
echo '<img src="images/clear.gif" width="1" height="12" border="0"><br clear="all">';
}
}
echo "</body></html>";
function writeHeader($m, $y, $dateline, $wday, $auth)
{
global $lang;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>phpEventCalendar: Event Display</title>
<link rel="stylesheet" type="text/css" href="css/popwin.css">
<?php if ($auth) { ?>
<script language="JavaScript">
function deleteConfirm(eid) {
var msg = "<?php echo $lang['deleteconfirm'] ?>";
if (confirm(msg)) {
opener.location = "eventsubmit.php?flag=delete&id=" + eid + "&month=<?php echo $m ?>&year=<?php echo $y ?>";
window.setTimeout('window.close()', 1000);
} else {
return;
}
}
</script>
<?php } ?>
</head>
<body>
<!-- selected date -->
<table cellspadding="0" cellspacing="0" border="0" width="300" bgcolor="#CCFFCC">
<tr>
<td bgcolor="#CCFFCC"><span bgcolor="#CCFFCC" class="display_header"><?php echo $dateline ?></span></td>
<td bgcolor="#CCFFCC" align="right"><span class="display_header"><?php echo $lang['days'][$wday] ?></span></td>
</tr>
</table>
<img src="images/clear.gif" width="1" height="3" border="0"><br clear="all">
<?php
}
function writePosting($id, $auth)
{
global $lang;
mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME) or die(mysql_error());
$sql = "SELECT y, m, d, title, text, start_time, end_time, ";
$sql .= DB_TABLE_PREFIX . "users.uid, fname, lname, ";
if (TIME_DISPLAY_FORMAT == "12hr") {
$sql .= "TIME_FORMAT(start_time, '%l:%i%p') AS stime, ";
$sql .= "TIME_FORMAT(end_time, '%l:%i%p') AS etime ";
} elseif (TIME_DISPLAY_FORMAT == "24hr") {
$sql .= "TIME_FORMAT(start_time, '%H:%i') AS stime, ";
$sql .= "TIME_FORMAT(end_time, '%H:%i') AS etime ";
} else {
echo "Bad time display format, check your configuration file.";
}
$sql .= "FROM " . DB_TABLE_PREFIX . "mssgs ";
$sql .= "LEFT JOIN " . DB_TABLE_PREFIX . "users ";
$sql .= "ON (" . DB_TABLE_PREFIX . "mssgs.uid = " . DB_TABLE_PREFIX . "users.uid) ";
$sql .= "WHERE id = " . $id;
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$title = stripslashes($row["title"]);
$body = stripslashes(str_replace("\n", "<br />", $row["text"]));
$postedby = $lang['postedby'] . ": " . $row['fname'] . " " . $row['lname'];
if (!($row["start_time"] == "55:55:55" && $row["end_time"] == "55:55:55")) {
if ($row["start_time"] == "55:55:55")
$starttime = "- -";
else
$starttime = $row["stime"];
if ($row["end_time"] == "55:55:55")
$endtime = "- -";
else
$endtime = $row["etime"];
$timestr = "$starttime - $endtime";
} else {
$timestr = "";
}
if ($auth == 2 || ($auth != 0 && $_SESSION['authdata']['uid'] == $row['uid'])) {
$editstr = "<span class=\"display_edit\">";
$editstr .= "[edit] ";
$editstr .= "[delete] </span>";
} else {
$editstr = "";
}
?>
<table cellspacing="0" cellpadding="0" border="0" width="300" bgcolor="#CCFFCC">
<tr><td bgcolor="#000000">
<table cellspacing="1" cellpadding="1" border="0" width="100%">
<tr>
<td class="display_title_bg" bgcolor="#CCFFCC"><table bgcolor="#CCFFCC" cellspacing="0" cellpadding="0" border="0" width="100%"><tr>
<td bgcolor="#CCFFCC" width="100%"><span class="display_title"> <?php echo $title ?></span></td>
<td bgcolor="#CCFFCC"><img src="images/clear.gif" width="20" height="1" border="0"></td>
<td bgcolor="#CCFFCC" align="right" nowrap="yes"><span class="display_title"><?php echo $timestr ?> </span></td>
</tr></table></td>
</tr>
<tr bgcolor="#CCFFCC"><td class="display_txt_bg" bgcolor="#CCFFCC">
<table cellspacing="1" cellpadding="1" border="0" width="100%" bgcolor="#CCFFCC">
<tr bgcolor="#CCFFCC">
<td bgcolor="#CCFFCC"><span class="display_txt"><?php echo $body ?></span></td>
</tr>
<tr bgcolor="#CCFFCC">
<td bgcolor="#CCFFCC"align="right"><span class="display_user"><?php echo $postedby ?></td>
</tr>
<tr bgcolor="#CCFFCC">
<td align="right" bgcolor="#CCFFCC"><?php echo $editstr ?></td>
</tr>
</table>
</td></tr>
</table>
</td></tr></table>
<?php
}
?>
To the best of my understanding writePosting function does most of the job and you need to enhance it to display more info about current event.
I've added a new table row at the end of this code sample to illustrate the idea.
<tr bgcolor="#CCFFCC">
<td bgcolor="#CCFFCC"><span class="display_txt"><?php echo $body ?></span></td>
</tr>
<tr bgcolor="#CCFFCC">
<td bgcolor="#CCFFCC"align="right"><span class="display_user"><?php echo $postedby ?></td>
</tr>
<tr bgcolor="#CCFFCC">
<td align="right" bgcolor="#CCFFCC"><?php echo $editstr ?></td>
</tr>
<tr bgcolor="#CCFFCC">
<td align="right" bgcolor="#CCFFCC"><?php echo "some extra info" ?></td>
</tr>

Categories