Home › Forums › JavaScript › Need to change when gig list deletes shows
- This topic is empty.
-
AuthorPosts
-
December 7, 2010 at 2:21 pm #30930
jbope
ParticipantI am using Chris’ Best Band Site for our schedule page. See it here <http://www.thishope.org/schedule.php>
Problem is that shows are auto deleting on the morning of the event. I need it to delete a couple of days later, or at least at the end of the day so that attendees can look up the location all day.
December 7, 2010 at 4:38 pm #70431TT_Mark
MemberDo you have the SQL code it is using to call the data from the database?
I’m guessing there will be a statement that says something like “SELECT * FROM Events WHERE EventDate > NOW()”. JUst change the “>” to “>=”.
December 8, 2010 at 11:59 am #70384jbope
ParticipantThanks TT_Mark. Here it is.
/* build output */
$query = 'SELECT show_id, date_starts, stime, venue, url, city, state,
DATE_FORMAT(date_starts,'%b %e') as ds
FROM shows
WHERE date_starts >= NOW()
ORDER BY date_starts ASC';
$result = mysql_query($query,$DATABASE_LINK) or die(mysql_error().': '.$query);
if(mysql_num_rows($result))
{
//heading
//for every show date
while($row = mysql_fetch_assoc($result))
{
//reset vars
$address = $dates = $event_venue = '';
//start row
$table.= '';';
//show dates
//$dates = $row.($row && $row!= $row ? ' - '.$row : '');
$dates = $row;
$table.= ''.$dates.'';
//show event/venue
if($row) { $event_venue.=''; }
//if($row) { $event_venue.= $row; }
//if($row && $row) { echo '
'; }
if($row) { $event_venue.= $row; }
if($row) { $event_venue.=''; }
$table.= ''.$event_venue.'';
//build & show address
//if($row) { $address.= $row.'
'; }
if($row) { $address.= $row; }
if($row && $row) { $address.= ', '; }
if($row) { $address.= $row; }
//if($row) { $address.= ' '.$row; }
$table.= ''.$address.'';
//show time
$table.= ''.($row ? $row : ' ').'';
//admin?
if($_SESSION)
{
$table.= '';
}
//end row
$table.= '';
$table.= '
}
}
else
{
//output general message
$table = 'Sorry! There is no show information available at this time. Check back soon!
';
}
?>
December 8, 2010 at 2:24 pm #70338TT_Mark
MemberHmm…that SQL statement looks right, did you change it to that or was it set to that already?
$query = 'SELECT show_id, date_starts, stime, venue, url, city, state,
DATE_FORMAT(date_starts,'%b %e') as ds
FROM shows
WHERE date_starts >= NOW()
ORDER BY date_starts ASC';This is the important bit, basically says pick anything where date is either today or in the future
December 9, 2010 at 11:36 am #70234jbope
ParticipantI didn’t change it. Shows are still being deleted at the beginning of the day. Can I change that code somehow to tell it to delete a few days after the event?
December 9, 2010 at 3:00 pm #70220clokey2k
ParticipantIf you can add one day to the query it would delete them the day after. My SQL knowledge suck but it should be doable by replacing the WHERE:
WHERE date_starts >= DATE_ADD(NOW(), INTERVAL 1 DAY)
This was modified from: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_adddate
It might work :-p.
December 10, 2010 at 11:07 am #70120jbope
ParticipantThanks all. Added a “-” to the 1 and it worked.
December 10, 2010 at 12:17 pm #70121clokey2k
ParticipantI was close!! Glad it helped…
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.