Jump to content

two date event code help


kamal213

Recommended Posts

Hi guys I have a script which displays the events on my calender throught the help of this code. In summary I basically was wondering how I could modify this code to display for events with a start and finish date:

IF(isset($events[$i])){
			echo "<div align=\"left\"><span class=\"eventinbox\">\n";
			while (list($key, $value) = each ($events[$i])) {
				echo " <a href=\"javascript:MM_openBrWindow('event.php?id=$value','','width=500,height=200');\">" . $event_info[$value]['1'] . " " . $event_info[$value]['0']  . "</a>\n<br>\n";
			}

			echo "</span></div>\n";
		}

 

That above is the display the events on the calender and here is the select query:

$sql = mysql_query("SELECT * FROM the_event WHERE event_month='$month' AND event_year='$year' ORDER BY event_time");
while($info = mysql_fetch_array($sql)){ 
    //planning to treat this as the event start date$day = $info['event_day'];
//I just added this column which would be the event end date$day2 = $info['event_day2'];
    $event_id = $info['events_id'];
    $events[$day][] = $info['events_id'];
    $event_info[$event_id]['0'] = substr($info['event_title'], 0, ;;
    $event_info[$event_id]['1'] = $info['event_time'];
}

 

Please let me know if you need more info

 

Thanks

Link to comment
Share on other sites

Thanks for your reply!

 

From your reply on dmhall0's post its seems you would have to put the events in an array in didnt really understand the sql query i.e.

$query = "SELECT * FROM health WHERE '$year-$month' BETWEEN EXTRACT(YEAR_MONTH FROM event_start) AND EXTRACT(YEAR_MONTH FROM event_end) ORDER BY id";

.

 

Could you give an example of how it would apply to me (Apologies for being a pain I am still learning php - this project is very difficult)

Link to comment
Share on other sites

What exactly about that query do you need help understanding? Even if you can not write a query, you should be able to read it and get the gist of what it is doing, possibly after you research what the mysql EXTRACT() function does or what the BETWEEN comparison does.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.