Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Need to change when gig list deletes shows

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #30930
    jbope
    Participant

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

    #70431
    TT_Mark
    Member

    Do 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 “>=”.

    #70384
    jbope
    Participant

    Thanks 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 : '&nbsp').'
    ';

    //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!

    ';
    }

    ?>
    #70338
    TT_Mark
    Member

    Hmm…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

    #70234
    jbope
    Participant

    I 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?

    #70220
    clokey2k
    Participant

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

    #70120
    jbope
    Participant

    Thanks all. Added a “-” to the 1 and it worked.

    #70121
    clokey2k
    Participant

    I was close!! Glad it helped…

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.