Jump to content
MakeWebGames

help with timestamps


corruptcity || skalman

Recommended Posts

hi im doing some work for a client and she wants me to create a website for her and 1 of the pages she wants is a schedule of what shes got going on within the next month broken down into 4 different tables this week next week week after next and within the month now im not that good with timestamps but was able to figure out how to make a timestamp using day and month input from the user but then when i try to output the info i get that there isnt event stuff planned in all 4 tables ive had a play around with the code and in my head it looks like it should work but it isnt lol

any way here is my code and any help will be appreciated

<?php

include_once"globals.php";

echo"<h3></h3>";

echo"Here are the schedules for this week, next week week after and within the next month

";


$strtweek = strtotime("monday");
$endweek = strtotime("sunday");

$thisweek=$db->query("SELECT * FROM schedule WHERE sch_date >= '$strtweek' AND sch_date <= '$endweek'
ORDER BY sch_date ASC, sch_name ASC");
if($db->num_rows($thisweek) == 0)
{
	echo"[b]There isnt anythink planned right now please check back at a later time.[/b]

";
}
else
{
	echo"[b]<u>This weeks Schedule</u>[b]

	<table width=100%>
	<tr>
	<th>Poster</th>
	<th>Name</th>
	<th>Venue</th>
	<th>More Info</th>
	<th>Time and Date</th>
	</tr>";

while($r=$db->fetch_row($thisweek))
{
	$date = date("d M Y", $r['sch_date']);
	echo"
	<tr>
	<td>[img={$r[]</td>
	<td>{$r['sch_name']}</td>
	<td>{$r['sch_venue']}</td>
	<td><a href='viewsch.php?ID={$r['sch_id']}'>More Information</td>
	<td>[b]{$date}[/b] at [b]{$r['sch_start_time']}.00[b]</td>
	</tr>";
}
	echo"</td></table>

";	
}

$strtweek2 = strtotime("+1 week monday");
$endweek2 = strtotime("+1 week sunday");

$thisweek2=$db->query("SELECT * FROM schedule WHERE sch_date >= '$strtweek2' AND sch_date <= '$endweek2' ORDER BY sch_date ASC, sch_name ASC");
if($db->num_rows($thisweek2) == 0)
{
	echo"

[b]There isnt anythink planned right now please check back at a later time.[/b]

";
}
else
{
	echo"[b]<u>Next weeks Schedule</u>[b]

	<table width=100%>
	<tr>
	<th>Poster</th>
	<th>Name</th>
	<th>Venue</th>
	<th>More Info</th>
	<th>Time and Date</th>
	</tr>";

while($r=$db->fetch_row($thisweek2))
{
	$date = date("d M Y", $r['sch_date']);
	echo"
	<tr>
	<td>[img={$r[]</td>
	<td>{$r['sch_name']}</td>
	<td>{$r['sch_venue']}</td>
	<td><a href='viewsch.php?ID={$r['sch_id']}'>More Information</td>
	<td>[b]{$date}[/b] at [b]{$r['sch_start_time']}.00[b]</td>
	</tr>";
}
	echo"</td></table>

";	
}

$strtweek3 = strtotime("+2 week monday");
$endweek3 = strtotime("+2 week sunday");


$thisweek3=$db->query("SELECT * FROM schedule WHERE sch_date >= '$strtweek3' AND sch_date <= '$endweek3' ORDER BY sch_date ASC, sch_name ASC");
if($db->num_rows($thisweek3) == 0)
{
	echo"

[b]There isnt anythink planned right now please check back at a later time.[/b]

";
}
else
{
	echo"[b]<u>Week after nexts Schedule</u>[b]

	<table width=100%>
	<tr>
	<th>Poster</th>
	<th>Name</th>
	<th>Venue</th>
	<th>More Info</th>
	<th>Time and Date</th>
	</tr>";

while($r=$db->fetch_row($thisweek3))
{
	$date = date("d M Y", $r['sch_date']);
	echo"
	<tr>
	<td>[img={$r[]</td>
	<td>{$r['sch_name']}</td>
	<td>{$r['sch_venue']}</td>
	<td><a href='viewsch.php?ID={$r['sch_id']}'>More Information</td>
	<td>[b]{$date}[/b] at [b]{$r['sch_start_time']}.00[b]</td>
	</tr>";
}
	echo"</td></table>

";	
}

$strtweek4 = strtotime("+3 week monday");
$endweek4 = strtotime("+3 week sunday");


$thisweek4=$db->query("SELECT * FROM schedule WHERE sch_date >= '$strtweek3' AND sch_date <= '$endweek3' ORDER BY sch_date ASC, sch_name ASC");
if($db->num_rows($thisweek4) == 0)
{
	echo"

[b]There isnt anythink planned right now please check back at a later time.[/b]

";
}
else
{
	echo"[b]<u>Schedule for the next month<u>[b]

	<table width=100%>
	<tr>
	<th>Poster</th>
	<th>Name</th>
	<th>Venue</th>
	<th>More Info</th>
	<th>Time and Date</th>
	</tr>";

while($r=$db->fetch_row($thisweek4))
{
	$date = date("d M Y", $r['sch_date']);
	echo"
	<tr>
	<td>[img={$r[]</td>
	<td>{$r['sch_name']}</td>
	<td>{$r['sch_venue']}</td>
	<td><a href='viewsch.php?ID={$r['sch_id']}'>More Information</td>
	<td>[b]{$date}[/b] at [b]{$r['sch_start_time']}.00[b]</td>
	</tr>";
}
	echo"</td></table>

";	
}


$h->endpage();

?>
Link to comment
Share on other sites

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.   Paste as plain text instead

  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...