Jump to content

MR


RussBM

Recommended Posts

 

What I need to do is display those returned events that fall between an open and a close date (between a two-week period for example 2022 08 15 to 2022 08 30) and if they do, I want to show and Register button that takes user to a registration page and if it is not true is show the user a Registration button that is not active that says "Registration Not Open". Right now, if one event is true and the rest are false, it will still return all are open for registration by showing the "Register" button for all returned events. The SQL is supposed to return the EventOpenDate (date event registration open) and EventCloseDate (date event registration is closed) and evaluated each returned event separately and show register button if the date falls between when the registration opens and when it is closed. ''' enter code here

            <div class="upcomming-events-area off-white ptb100">
                  <div class="container">
                      <div class="row">
                          <div class="col-xs-12">
                           <h1 class="section-title">Available Sporting Events for Registration <?php /*echo ($_SESSION['usrid'])*/?></h1>
                        </div>
                        <div class="total-upcomming-event col-md-12 col-sm-12 col-xs-12">

                        <?php
                                // Fetching Upcoming events user has NOT signed up for (all-events.php line 69 - Updated 6/25/2021)
                                $isactive=1;
                                //$uid=$_SESSION['usrid'];
                                $sql = "SELECT 
                                            EventName,
                                            EventLocation,
                                            EventStartDate,
                                            EventEndDate,
                                            EventOpenDate,
                                            EventCloseDate,
                                            EventImage,id
                                        FROM tblevents 
                                        WHERE NOT EXISTS (SELECT 
                                            tblbookings.EventId,    
                                            tblbookings.UserId 
                                        FROM tblbookings 
                                        WHERE tblbookings.EventId = tblevents.id 
                                        AND tblbookings.UserId = $_SESSION[usrid]
                                        /*AND tblbookings.bookingtatus = confirmed*/)
                                        AND IsActive=:isactive
                                       /*AND EventStartOpenDate => now() 
                                        AND EventCloseDate => now() */
                                        ORDER BY EventOpenDate DESC";
                                        /*ORDER BY EventStartDate ASC "*/
                                        
                                $query = $dbh -> prepare($sql);
                                $query->bindParam(':isactive',$isactive,PDO::PARAM_STR);
                                $query->execute();
                                $results=$query->fetchAll(PDO::FETCH_OBJ);
                                $cnt=1;
                                    if($query->rowCount() > 0)
                                        {
                                        foreach($results as $row)
                                        { 
                            ?>
                            
                              <div class="single-upcomming shadow-box">
                                 <div class="col-md-4 hidden-sm col-xs-12">
                                     <div class="sue-pic">
                                        <img src="admin/eventimages/<?php echo htmlentities($row->EventImage);?>" alt="<?php echo htmlentities($row->EventName);?>" style="border:#000 1px solid"> 
                                     </div>
                                     <div class="sue-date-time text-center">
                                         <span><?php echo htmlentities($row->EventStartDate);?></span>To
                                         <span><?php echo htmlentities($row->EventEndDate);?></span>
                                     </div>
                                     <div class="sue-date-time text-center">
                                         <span><?php echo htmlentities($row->EventOpenDate);?></span>To
                                         <span><?php echo htmlentities($row->EventCloseDate);?></span>
                                     </div>
                                 </div>
                                 <div class="col-md-3 col-sm-5 col-xs-12">
                                    <div class="uc-event-title">
                                        <div class="uc-icon"><i class="zmdi zmdi-globe-alt"></i></div>
                                        <a href="#"><?php echo htmlentities($row->EventName);?></a><br>
                                        <a href="#"><?php if($row > 1) echo ('Pending'); else echo htmlentities($row->BookingStatus);?></a>
                                    </div> 
                                 </div> 
                                 <div class="col-md-2 col-sm-3 col-xs-12">
                                     <div class="venu-no">
                                         <p>Location : <?php echo htmlentities($row->EventLocation);?></p>
                                     </div>
                                 </div>
                                 <?php
                                 if (($currentDate >= $EventOpenDate) && ($EventCloseDate <= $currentDate)){?>
                                    <div class="col-md-3 col-sm-4 col-xs-12">
                                     <div class="upcomming-ticket text-center">
                                        <a href="event-details.php?evntid=<?php echo htmlentities($row->id);?>" class="btn-def bnt-2 small">Registration</a>
                                    </div>
                                 </div>
                                
                                 <?php }else{ ?>
                                 <div class="col-md-3 col-sm-4 col-xs-12">
                                     <div class="upcomming-ticket text-center">
                                        <a class="btn-def bnt-2 small">Registration not Open</a>
                                     </div>
                                 </div> 
                                <?php } ?>

                              </div>
                                <?php } }  else { ?>                
                                    <p>No Record Found - (Make sure you are logged in to see the events)</p>    
                                <?php } ?>     
                             <hr />
                          
                          </div>
                      </div>
                  </div>
              </div>

 

Link to comment
Share on other sites

God!  It would be so nice if forum users took the time to re-read their intended post to make sure that it reads well and actually says what the poster thinks he is saying.  Break up run-on sentences so one doesn't have to read thru it 3 times to understand it.  Recognize the repetitive flow of words and cut them down to be more precise and in general present a very clear question.

OH!  And provide a meaningful topic name.  That is key to get the attention of the people who you are hoping will read your post and contribute.  MR.  Really?  What is MR supposed to tell us?

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.