<?php
include ('ctx.php');
//
//
//$result = mysqli_query($con,"select * from iwia_events where event_start < now() and event_end > DATE_ADD(DATE(now()), INTERVAL 11 MONTH)");
//$sql="select * from iwia_events WHERE event_start BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 7 DAY)";
$sql="select * from iwia_events where event_start <= now() and event_end >= now()";
//$sql="select * from iwia_events where event_start < DATE_ADD(CURDATE(), INTERVAL -1 DAY) and event_end > CURDATE()";
//$sql="SELECT * FROM iwia_events WHERE event_start BETWEEN DATE_ADD(CURDATE(), INTERVAL -1 DAY) AND event_end > CURDATE()";
$result = mysqli_query($con,$sql);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
echo "<strong style='color:black;'>".date('l jS \of F')."</strong><br>";
while($row = mysqli_fetch_array($result))
{
$start_event=date('m-d-Y', strtotime($row['event_start']));
$end_event=date('m-d-Y', strtotime($row['event_end']));
if ($row['active'] == "1") {
echo '<IMG SRC="'.$row['event_image'].'" ALT="?" BORDER=0 style="width:90px; height:90px;" align="left"></div><br>';
//echo "Location: ".$row['event_location']."<br>";
if ($row['event_location']) {
$loc = "Location: ".$row['event_location']."";
}
else {
$loc="";
}
echo " <A HREF='single_event.php?id=".$row['id']."' title=\"".$loc."\">".$row['event_title'] . "</a> <br>";
echo "<span style='font-size: 10px; color: gray;'> Start: " . $start_event ." - End: ".$end_event."</span>";
echo "<p> </p>";
}
}
if (!mysqli_num_rows($result)) {
echo "No Events for today<br>";
}
mysqli_close($con);
?>
<?php
error_reporting(E_ALL);
echo 'Showing events for: : ' . $_SESSION['subdomain'] . '<br>';
$pieces = explode("-", $_SESSION['subdomain']);
$subdomain_city =strtolower($pieces[0]);
$subdomain_state=strtolower($pieces[1]);
//echo $subdomain_state;
include ('mysqli_ctx.php');
$sql="SELECT * FROM iwia_events WHERE event_start <= NOW() and event_end >= NOW() AND active = '1' AND `event_location` LIKE LOWER('%$subdomain_city%') AND `event_location` LIKE LOWER('%$subdomain_state%')";
if (!$res = $mysqli->query($sql))
{
$err
= "QUERY FAIL: "
. $sql
. ' ERRNO: '
. $mysqli->errno
. ' ERROR: '
. $mysqli->error
;
trigger_error($err, E_USER_ERROR);
}
// IF WE GET THIS FAR, THE QUERY SUCCEEDED AND WE HAVE A RESULT OBJECT IN $res
// AND SO WE CAN NOW USE $res IN OTHER MYSQLI FUNCTIONS
// DETERMINE HOW MANY ROWS OF RESULTS WE GOT
$num = $res->num_rows;
$num_fmt = number_format($num);
if (!$num)
{
//echo "<br/>QUERY: $sql ";
echo "<br/>No Events for today<br> ";
echo PHP_EOL;
}
else
{
//echo "<br/>QUERY: $sql ";
echo "<br/>FOUND $num_fmt Events <br/>";
echo PHP_EOL;
}
echo "<strong style='color:black;'>".date('l jS \o\f F')."</strong><br>";
echo '<pre>';
while ($row = $res->fetch_object())
{
print_r($row);
}
ASKER
INSERT INTO `iwia_events` (`id`, `event_title`, `event_location`, `event_price`, `event_image`, `event_url`, `event_start`, `event_end`, `event_text`, `extra_info`, `facebook`, `twitter`, `active`, `categories`) VALUES
(1, 'Metal Machine Monday- Upstairs at EXIT', 'Exit\r\n1315 W North Ave\r\nChicago, IL, 60642-1513', 'Free', 'https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-prn1/c268.0.315.315/s552x414/560827_10151619336171173_851548175_n.jpg', '', '2013-08-26 22:00:00', '2013-08-27 04:00:00', 'Mondays are a celebration of the rhythm of machines at work upstairs at EXIT. Walls of distortion, driven by drums. An eclectic mix of MusicK from the most current sounds in Death Disco to digital rockstars awash in the history of analog warmth.\r\n\r\nIndustrial/EBM/Goth/Metal\r\n\r\nEBM or metal? Let your body decide. Your reaction steers this ship into space or into the bowels of Hades. If you dance you will receive dance music, if not we will supply the other side of the coin.\r\n\r\nResident Djs Restriction & Peter Propaganda will be joined weekly by guest djs and an assortment of surprise guests performers and freaks they call friends\r\n\r\nXtina will be behind the bar mixing her specialty drinks like the “Machine Sex” for your consumption…', NULL, '0', '0', '1', 'DJ''S / DANCING'),
(2, '50 cent Boneless Wings', 'Wing Stop\r\n3326 North Western Avenue\r\nRiverview Plaza, Chicago, IL 60618', NULL, 'http://chicagoil.iswhereitsat.com/wp-content/themes-ai1ec/vortex/img/default-event-avatar.png', '', '2013-08-27 11:00:00', '2013-08-27 22:00:00', 'Date: Every Tuesday!\r\nTime: 11a.m. – 10p.m.\r\nPlace: Wing Stop\r\n\r\nAll varieties of wings are only 50 cents on Monday and Tuesday!', NULL, '0', '0', '1', 'FOOD SPECIALS'),
(3, 'Lincoln Park Zoo’s Edible Garden', 'Farm In The Zoo\r\n2001 North Clark Street\r\nChicago, IL 60614', 'Free', 'http://chicagoil.iswhereitsat.com/wp-content/uploads/sites/10/2013/06/edible-garden2.jpg', '', '2013-08-27 10:00:00', '2013-11-01 13:00:00', 'Learn Where Your Food Comes From!\r\nThe Edible Garden, located in the Farm-in-the-Zoo and planted and maintained by Chicago’s Green City Market, lets kids experience hands-on lessons on the origins of food. Family visits and field trips offer the opportunity to plant, weed, compost and harvest, establishing a deeper connection to the resources that sustain us all.\r\n\r\nThe seasonal “green thumb” fun includes planting tomatoes, pulling weeds, thinning carrots, harvesting green beans and digging purple potatoes. It’s an inclusive harvest—the Edible Garden is designed to accommodate children with disabilities.', NULL, '0', '0', '1', 'FAMILY FUN, HEALTH & FITNESS, NATURE & WILDLIFE'),
(4, 'Happy Hour at Frankie’s 5th Floor Pizzeria', 'Frankie''s 5th Floor Pizzeria\r\n900 North Michigan\r\nChicago, IL 60611', NULL, 'http://chicagoil.iswhereitsat.com/wp-content/themes-ai1ec/vortex/img/default-event-avatar.png', 'http://http//www.shop900.com/events/462/', '2013-08-27 15:00:00', '2013-10-31 18:00:00', 'Looking for a great spot to bring your co-workers for an early evening beverage or a place to meet a friend for appetizers and cocktails? Well, Frankie’s new ‘Happy Hour Specials’ are here! Frankie’s offers bar plates priced at $1-$5, including homemade meatballs, calamari pepperonata, roasted chicken thighs and so much more. Daily ‘Drink Specials’ for as low as $5.', 'CONTACT:\r\n(312) 266-2500', '0', '0', '1', 'DRINK SPECIALS, RETAIL SALES'),
(5, 'Socrates Party', '709 S Randolph St Champaign, IL 61820', '25', 'http://chicagoil.iswhereitsat.com/wp-content/themes-ai1ec/vortex/img/default-event-avatar.png', '', '2013-08-30 22:44:00', '2013-09-28 22:44:00', 'This is the party for having a system that works', 'We will be committing crimes against nature :)', '0', '0', '1', 'party, DJ, rave'),
(6, 'NASCAR Contenders Live', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-09-01 18:00:00', '2013-09-12 20:00:00', 'Back by popular demand\\, NASCAR Contenders LiveSM Sponsored byToyota will make its return to Chicago on September 12 for the second-consecutive year\\, just days before the first race of the 2013 Chase for the NASCAR Sprint Cup™ at Chicago land Speedway. Signaling the start of the most intense and competitive stretch of the NASCAR season\\, NASCAR Contenders Live features all 12 Chase for the NASCAR Sprint Cup drivers interacting on stage\\, providing fans an insider’s look at how the competitors plan to claim', 'Location: Grand Ballroom<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(7, 'Countdown to the Centennial', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-09-21 00:00:00', '2013-09-22 00:00:00', 'Doors open at 5 p.m.\\nCountdown to the Centennial is a community celebration with free services\\, an interactive art and photo exhibit\\,a biblical presentation for enlightenment\\, hope and happiness\\, and a liveshowcase of original Christian music to inspire and delight the soul. For', 'Location: Grand Ballroom<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(8, 'The Doc McStuffins Mobile', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-08-25 14:00:00', '2013-08-25 21:00:00', 'Join Disney Junior at The Doc Mobile for a family-fun event focused on healthy living as kids see “there’s so much you can do to take careof you!†They’ll be moving & shaking along to their favorite Doc songs with Radio Disney Junior\\, and experiencing activities showing them how to make a healthy plate and the importance of drinking enough water. Be sure tobring a toy so kids can be just like Doc and give their toy a check-up inside Doc’s clinic! Doc’s got just the right diagnosis that makes staying healthy and doctor visits so much fun for your little one!\\n \\nAlso\\, StartingFriday\\, September 6\\, your little one can see new episodes of Doc McStuffins every Friday all month long on Disney Junior\\, on Disney Channel! The premiere episode features Doc’s new mobile clinic so she can help toys on-th', 'Location: Compass Rose<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(9, 'BIGMINI', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-08-05 00:00:00', '2013-08-12 00:00:00', 'Our garden is in full bloom – with the bigger\\, 4-door MINI Countryman\\, that is. Come down to Navy Pier’s Pier Park to check out the BIGMINI in all its natural glory today. Who knows? It may even grow before youreyes.', 'Location: Pier Park<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(10, 'SOFA CHICAGO 2013', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-10-31 00:00:00', '2013-11-04 00:00:00', 'The 20th Annual Exposition of Sculpture Objects and FunctionalArt Fair is a gallery-presented\\, international art exposition dedicated tobridging the worlds of design\\, decorative and fine art. Works by emergingand established artists and designers are available for sale by premier ga', 'Location: Festival Hall<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(11, 'Shoreline Sightseeing Oktoberfest Cruise', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-09-28 00:00:00', '2013-09-28 02:00:00', 'Two-hour cruise with German dinner including brats from PaulinaMarket\\, free drink in a souvenir mug and German music. Cash bar available', 'Location: Gateway Park at Navy Pier<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(12, 'Texas on Tour', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-08-18 16:00:00', '2013-08-18 23:00:00', 'Texas Tourism has rolled into Chicago this weekend! Come out toNavy Pier and experience Texas on Tour\\, an all-new experiential exhibit that gives potential travelers a taste of the fun and adventure the Lone Star State has to offer.\\n \\nThe exhibit virtually transports participants to', 'Location: Gateway Park<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(13, 'Texas on Tour', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-08-17 16:00:00', '2013-08-18 02:00:00', 'Texas Tourism has rolled into Chicago this weekend! Come out toNavy Pier and experience Texas on Tour\\, an all-new experiential exhibit that gives potential travelers a taste of the fun and adventure the Lone Star State has to offer.\\n \\nThe exhibit virtually transports participants to', 'Location: Gateway Park<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(14, 'Texas on Tour', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-08-16 17:00:00', '2013-08-17 01:00:00', 'Texas Tourism has rolled into Chicago this weekend! Come out toNavy Pier and experience Texas on Tour\\, an all-new experiential exhibit that gives potential travelers a taste of the fun and adventure the Lone Star State has to offer.\\n \\nThe exhibit virtually transports participants to', 'Location: Gateway Park<br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(15, 'Shoreline Water Taxi Transfers for Taylor Swift Concert at SoldierField', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-08-10 00:00:00', '2013-08-11 00:00:00', 'Shoreline Water Taxi Transfers are available for round trip transportation from Navy Pier to Museum Campus/Soldier Field for the Taylor Sw', 'Location: <br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event'),
(16, 'Shoreline Sightseeing Wine Tasting Cruise', 'Navy Pier, Inc 600 E Grand Ave, Chicago, IL 60611', NULL, 'http://blog.navypier.com/wp-content/uploads/headway/header-uploads/navy-blog2_08.png', 'http://blog.navypier.com', '2013-09-12 00:00:00', '2013-09-13 00:00:00', 'Featuring wines of Chicago-area Lynfred Winery plus light refreshments and a ninety-minute cruise on Shoreline''s climate controlled "Celeb', 'Location: <br>Navy Pier, Inc <br>600 E Grand Ave, Chicago, IL 60611<br>Phone: (312) 595-7437', '0', '0', '1', 'Navy Pier Event');
ASKER
Showing events for: : chicago-il
FOUND 3 Events
Monday 2nd of September
stdClass Object
(
[id] => 3
[event_title] => Lincoln Park Zoo’s Edible Garden
[event_location] => Farm In The Zoo
2001 North Clark Street
Chicago, IL 60614
[event_price] => Free
[event_image] => http://chicagoil.iswhereitsat.com/wp-content/uploads/sites/10/2013/06/edible-garden2.jpg
[event_url] =>
[event_start] => 2013-08-27 10:00:00
[event_end] => 2013-11-01 13:00:00
[event_text] => Learn Where Your Food Comes From!
The Edible Garden, located in the Farm-in-the-Zoo and planted and maintained by Chicago’s Green City Market, lets kids experience hands-on lessons on the origins of food. Family visits and field trips offer the opportunity to plant, weed, compost and harvest, establishing a deeper connection to the resources that sustain us all.
The seasonal “green thumb” fun includes planting tomatoes, pulling weeds, thinning carrots, harvesting green beans and digging purple potatoes. It’s an inclusive harvest—the Edible Garden is designed to accommodate children with disabilities.
[extra_info] =>
[facebook] => 0
[twitter] => 0
[active] => 1
[categories] => FAMILY FUN, HEALTH & FITNESS, NATURE & WILDLIFE
)
stdClass Object
(
[id] => 4
[event_title] => Happy Hour at Frankie’s 5th Floor Pizzeria
[event_location] => Frankie's 5th Floor Pizzeria
900 North Michigan
Chicago, IL 60611
[event_price] =>
[event_image] => http://chicagoil.iswhereitsat.com/wp-content/themes-ai1ec/vortex/img/default-event-avatar.png
[event_url] => http://http//www.shop900.com/events/462/
[event_start] => 2013-08-27 15:00:00
[event_end] => 2013-10-31 18:00:00
[event_text] => Looking for a great spot to bring your co-workers for an early evening beverage or a place to meet a friend for appetizers and cocktails? Well, Frankie’s new ‘Happy Hour Specials’ are here! Frankie’s offers bar plates priced at $1-$5, including homemade meatballs, calamari pepperonata, roasted chicken thighs and so much more. Daily ‘Drink Specials’ for as low as $5.
[extra_info] => CONTACT:
(312) 266-2500
[facebook] => 0
[twitter] => 0
[active] => 1
[categories] => DRINK SPECIALS, RETAIL SALES
)
stdClass Object
(
[id] => 63
[event_title] => A Month Of Storytelling Open Mic
[event_location] => Chicago, IL 60611
[event_price] =>
[event_image] => http://gapersblock.com/gfx/gapersblock_250x250.jpg
[event_url] => http://gapersblock.com
[event_start] => 2013-09-02 01:30:00
[event_end] => 2013-12-12 01:30:00
[event_text] => A Month Of is a new monthly, open-mic storytelling series where the audience selects the event's theme online before the show starts. Open mic slots are 5-7 minutes long, all story types and forms are welcome. The show is every...
[extra_info] =>
[facebook] => 0
[twitter] => 0
[active] => 1
[categories] => Gapers Block Slowdown Event
)
ASKER
for ($i = 1; $i <= {how would we stop, can we capture end of year maybe}; $i++) {
$sql="SELECT * FROM iwia_events WHERE event_start <= (now() + INTERVAL $i DAY) AND event_end >= (now() + INTERVAL &i DAY) AND active = '1' AND `event_location` LIKE LOWER('%$subdomain_city%') AND `event_location` LIKE LOWER('%$subdomain_state%')";
echo "<strong style='color:black;'>".date('l jS \of F',strtotime('+$i day'))."</strong><br>";
// do event data output block
}
ASKER
$datetime1 = date_create('now');
$datetime2 = date_create('2014-01-01');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');
// $interval = how many days?
$days_till_end_of_year = $interval->format('%a');
ASKER
$event['DESCRIPTION'] = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $event['DESCRIPTION']);
thank you i shoulda known you would have a page too
ASKER
ASKER
<?
session_start();
//****************************************************************
// Filename..: __.php
// Author....: __
// Date......: mm/dd/yyyy
// Purpose...: __
// SQL.......: server/database/tables/tablename
//****************************************************************
// include("filename.php");
include ('mysqli_ctx.php');
include("iwia_location_subdomain.php");
echo 'Showing events for: : ' . $_SESSION['subdomain'] . '<br>';
$pieces = explode("-", $_SESSION['subdomain']);
$subdomain_city =strtolower($pieces[0]);
$subdomain_state=strtolower($pieces[1]);
//echo $subdomain_state;
$datetime1 = date_create('now');
$datetime2 = date_create('2014-01-01');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days')."<br>";
// $interval = how many days?
$days_till_end_of_year = $interval->format('%a');
for ($i = 1; $i <= $days_till_end_of_year; $i++) {
$sql="SELECT * FROM iwia_events WHERE event_start <= (now() + INTERVAL $i DAY) AND event_end >= (now() + INTERVAL $i DAY) AND active = '1' AND `event_location` LIKE LOWER('%$subdomain_city%') AND `event_location` LIKE LOWER('%$subdomain_state%')";
echo"sql: ".$sql."<br>";
echo "<strong style='color:black;'>".date('l jS \of F',strtotime('+$i day'))."</strong><br>";
$res = $mysqli->query($sql);
// IF mysqli_query() RETURNS FALSE, LOG AND SHOW THE ERROR
if (!$res)
{
$err
= "QUERY FAIL: "
. $sql
. '<br> ERRNO: '
. $mysqli->errno
. '<br> ERROR: '
. $mysqli->error
;
trigger_error($err, E_USER_ERROR);
}
// IF WE GET THIS FAR, THE QUERY SUCCEEDED AND WE HAVE A RESULT OBJECT IN $res
// AND SO WE CAN NOW USE $res IN OTHER MYSQLI FUNCTIONS
// DETERMINE HOW MANY ROWS OF RESULTS WE GOT
$num = $res->num_rows;
$num_fmt = number_format($num);
if (!$num)
{
//echo "<br/>QUERY: $sql ";
echo "<br/>No Events for today<br> ";
echo PHP_EOL;
}
else
{
//echo "<br/>QUERY: $sql ";
echo "<br/>FOUND $num_fmt Events <br/>";
echo PHP_EOL;
}
// do event data output block
while ($row = $res->fetch_array())
{
$start_event=date('m-d-Y', strtotime($row['event_start']));
$end_event=date('m-d-Y', strtotime($row['event_end']));
if ($row['active'] == "1") {
echo '<IMG SRC="'.$row['event_image'].'" ALT="?" BORDER=0 style="width:90px; height:90px;" align="left"></div><br>';
//echo "Location: ".$row['event_location']."<br>";
if ($row['event_location']) {
$loc = "Location: ".$row['event_location']."";
}
else {
$loc="";
}
echo " <A HREF='single_event.php?id=".$row['id']."' title=\"".$loc."\">".$row['event_title'] . "</a> <br>";
echo "<span style='font-size: 10px; color: gray;'> Start: " . $start_event ." - End: ".$end_event."</span>";
echo "<p> </p>";
}
}
}
mysqli_close($mysqli);
?>
ASKER
ASKER
<?
session_start();
//****************************************************************
// Filename..: __.php
// Author....: __
// Date......: mm/dd/yyyy
// Purpose...: __
// SQL.......: server/database/tables/tablename
//****************************************************************
// include("filename.php");
include ('mysqli_ctx.php');
include("iwia_location_subdomain.php");
echo 'Showing events for: : ' . $_SESSION['subdomain'] . '<br>';
$pieces = explode("-", $_SESSION['subdomain']);
$subdomain_city =strtolower($pieces[0]);
$subdomain_state=strtolower($pieces[1]);
//echo $subdomain_state;
$datetime1 = date_create('now');
$datetime2 = date_create('2014-01-01');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days')."<br>";
// $interval = how many days?
$days_till_end_of_year = $interval->format('%a');
$today = date('c');
$cutoff = date('c', strtotime('2014-01-01'));
//SELECT cols FROM tables WHERE (event_start < '$cutoff') AND (event_start >= '$today' OR event_end >= '$today') ORDER BY event_start
for ($i = 1; $i <= $days_till_end_of_year; $i++) {
$sql="SELECT * FROM iwia_events WHERE event_start <= (now() + INTERVAL $i DAY) AND event_end >= (now() + INTERVAL $i DAY) AND active = '1' AND `event_location` LIKE LOWER('%$subdomain_city%') AND `event_location` LIKE LOWER('%$subdomain_state%')";
//echo"sql: ".$sql."<br>";
// replace time() with the time stamp you want to add one day to
$startDate = time();
$day_plus="+".$i." day";
echo "<strong style='color:black;'>".date('l jS \of F', strtotime($day_plus, $startDate))."</strong><br>";
$res = $mysqli->query($sql);
// IF mysqli_query() RETURNS FALSE, LOG AND SHOW THE ERROR
if (!$res)
{
$err
= "QUERY FAIL: "
. $sql
. '<br> ERRNO: '
. $mysqli->errno
. '<br> ERROR: '
. $mysqli->error
;
trigger_error($err, E_USER_ERROR);
}
// IF WE GET THIS FAR, THE QUERY SUCCEEDED AND WE HAVE A RESULT OBJECT IN $res
// AND SO WE CAN NOW USE $res IN OTHER MYSQLI FUNCTIONS
// DETERMINE HOW MANY ROWS OF RESULTS WE GOT
$num = $res->num_rows;
$num_fmt = number_format($num);
if (!$num)
{
//echo "<br/>QUERY: $sql ";
echo "<br/>No Events for today<br> ";
echo PHP_EOL;
}
else
{
//echo "<br/>QUERY: $sql ";
echo "<br/>FOUND $num_fmt Events <br/>";
echo PHP_EOL;
}
// do event data output block
while ($row = $res->fetch_array())
{
$start_event=date('m-d-Y', strtotime($row['event_start']));
$end_event=date('m-d-Y', strtotime($row['event_end']));
if ($row['active'] == "1") {
echo '<IMG SRC="'.$row['event_image'].'" ALT="event_image" BORDER=0 style="width:90px; height:90px;" align="left"></div><br>';
//echo "Location: ".$row['event_location']."<br>";
if ($row['event_location']) {
$loc = "Location: ".$row['event_location']."";
}
else {
$loc="";
}
echo " <A HREF='single_event.php?id=".$row['id']."' title=\"".$loc."\">".$row['event_title'] . "</a> <br>";
echo "<span style='font-size: 10px; color: gray;'> Start: " . $start_event ." - End: ".$end_event."</span>";
echo "<p> </p>";
}
}
}
mysqli_close($mysqli);
?>
ASKER
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
ASKER
Open in new window
Open in new window
it seams to be correct now ** i have been wanting to make functions and add a mysqli_functions.php file to project instead of looking up the routines each time. i never came across one yet, not looking forward to making one but i should find one or make one soon. I do like Mysqli better it seems to have more it can do. thank you as always
on to date time suggestions
Practical Application #12 seams close to what im trying to do. (i didnt see it pop out at me for any help tho on my current display issue)
i still think im beating my head against the wall (im not sure if you remeber i was trying to work on adding stringtotime parsed dates to mysql for events.) i finally got that to work. but each day is counted as a entry(database fills up really fast for recurring dates) im also finding events are really hard to do(code wise).
but lets try and get this solved and maybe ill ask how i SHOULD be doing this as recurring events(if they can't be melded)
heres my current create event info
Open in new window
im fully open to changing what ever needs to be changed and i am by all means willing to admit im not doing this correctly or there a better way. again thank you for any help