Jump to content

Archived

This topic is now archived and is closed to further replies.

whitehat

retrieving id's by current month

Recommended Posts

Hello @all
i'm working on this project:
http://www.inteladd.com/modules.php?name=Fly_to_Basket&file=products
Currently only working in IE.
As you can see when click a date , it add it to the right basket.
However as you might seen it take a while before the page is loaded , this is couse it have to load 365 dates out of the db at once.
I'm looking for a solution to catch only the selected month''s dates out of the db instead of all 365.
This is the code i use for this page.
If anyone can solve my problem with this i would much apreciate:
[code]
if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}

define('INDEX_FILE', true);
require_once("mainfile.php");
require_once("source/activecalendar.php");

$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
global $db;

$myurl= 'modules.php?name=Fly_to_Basket&file=products'; // the links url is this page
$yearID=false; // GET variable for the year (set in Active Calendar Class), init false to display current year
$monthID=false; // GET variable for the month (set in Active Calendar Class), init false to display current month
$dayID=false; // GET variable for the day (set in Active Calendar Class), init false to display current day
extract($_GET);



$cal=new activeCalendar($yearID,$monthID,$dayID);


$eventID="event"; // sets the name of the generated HTML class on the event day (css layout)
$result = $db->sql_query("SELECT UNIX_TIMESTAMP(calendar_date) AS calendar_date, calendar_id, did FROM calendar");






OpenTable();
while ($row = $db->sql_fetchrow($result, MYSQL_BOTH)){
$mysqlDay=date("j",$row["calendar_date"]); // makes a day out of the database date
$mysqlMonth=date("n",$row["calendar_date"]); // makes a month out of the database date
$mysqlYear=date("Y",$row["calendar_date"]); // makes a year out of the database date
$mysqlContent= $row["did"]; // gets the event content
$products_id = $row["calendar_id"];
//$mysqlLink=$row[$tblLink]; // gets the event link
$mysqlLink = "#\" onclick=\"addToBasket('$products_id','$calendar_name','$calendar_price');return false;"; // the name of your MySQL Table Link Field
$cal->setEvent($mysqlYear,$mysqlMonth,$mysqlDay,$eventID); // set the event, if you want the whole day to be an event
$cal->setEventContent($mysqlYear,$mysqlMonth,$mysqlDay,$mysqlContent,$mysqlLink); // set the event content and link


?>
//here a 2 javascript files called
<?php



echo"<div id=\"slidingProduct_".$products_id."\"></div>";
}
$cal->enableMonthNav($myurl);

echo $cal->showMonth();




CloseTable();

include("footer.php");

?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.