jk215 Posted November 6, 2007 Share Posted November 6, 2007 Hi everyone. Im working with a flatfile database text file and was wondering if anyone might be able to help me out with what I want to accomplish. Basically the .txt is a listing of events that my work shows everyday. I have everything working perfectly so far with outputting the data. Here is my code (please be nice Im not a real programmer ): <div id="downstairsshows"> <? $fp = fopen('downstairs.txt','r'); if (!$fp) {echo 'ERROR: Unable to open file.'; exit;} $counter = 1; while ($counter <= 6) { $line = fgets($fp, 1024); //use 2048 if very long lines list ($dayofweek, $month, $daynumber, $presents, $showtitle, $with, $ticketlink, $thumbnail) = split ('\|', $line); $thumbnail = '<img src="images/thumbnails/'.$thumbnail.'" '.'width="50px" height="50px" alt="'.$showtitle.'" /> <br />'."\n"; echo '<div class="showlisting">'; echo '<div class="thumbnailcontainer">'; echo $thumbnail; echo '</div>'; echo '<div class="listingdetails">'; echo '<span class="bold">'.$dayofweek . ', ' . $month .' '. $daynumber . '</span><br />'."\n"; echo $presents . '<a href="'.$ticketlink.'"> '.'<h2>'.$showtitle.'</h2>'.'</a><br />'."\n"; echo $with . '<br />'."\n"; echo '</div>'; echo '</div>'; $counter++; } fclose($fp); ?> </div> So basically its just running through the lines and outputting them as a listing on the webpage and people can click to purchase tickets. My question is, can I add some sort of conditional statement that would check todays date from the server, match it up against the date of the show thats being listed, and decide whether or not to display it? For instance if its November 7, the output would skip all the listings that are before November 7 and just loop the next 6 shows starting from there. Sorry if that doesnt seem very clear. Basically I just want to load all the dates for a month or so into the flatfile and have it automatically output the dates coming up and ignore dates already posted. Im pretty sure I should be using a mysql database for this but Ive been having a load of trouble with it because my company is using shitty Yahoo Small Business hosting. Any help is appreciated! Quote Link to comment Share on other sites More sharing options...
jk215 Posted November 6, 2007 Author Share Posted November 6, 2007 bump..please help a n00ber mcn00berson! Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted November 6, 2007 Share Posted November 6, 2007 Post a copy of the text file. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted November 6, 2007 Share Posted November 6, 2007 <?php $month2= date("F"); $day2=date("l"); if($month=>November ||$month2=>November||$day2=>17)||$daynumber=>17) { ///show listing }else{ //dont show listing } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.