Bliss C 0 Newbie Poster

Unfortunately I seem to have forgotten everything I ever knew about PHP and MySQL (which wasn't a lot anyway) and I've had one hell of a headache all day which is somewhat clouding my thinking. :X

I have two PHP includes on a current site I'm working on advertising a charity bookstall. One include shows the dates when the bookstall will be held - it's a simple if/ifelse list that displays the dates when the bookstall will be held in that month, for example, the first bit of the script is...

<?php
$thismonth = date("m");
if ($thismonth=="01") // list January's dates
	  {
	  echo "<ul id=\"dateslist\">";
	  echo "<li>Wed, 7th January</li>";
	  echo "<li>Wed, 14th January</li>";
	  echo "<li>Wed, 21st January</li>";
	  echo "<li>Wed, 28th January</li>";
	  echo "</ul>";
	  }
elseif ($thismonth=="02") // list February's dates	  
	  {
	  echo "<ul id=\"dateslist\">";
	  echo "<li>Wed, 4th February</li>";
	  echo "<li>Wed, 11th February</li>";
	  echo "<li>Wed, 18th February</li>";
	  echo "<li>Wed, 25th February</li>";
	  echo "</ul>";
	  }

etc., etc.

To display the dates I simply include the file...

<?php include('includes/dateslist.php'); ?>

On the home page though I need a section of the page which displays just the date of the next bookstall. Obviously I want to do it without duplicating code if possible, but I can't figure out how I can pull off just the next date (one date as opposed to all the dates for the month) from that list.

My second include displays the current amount the stall has raised using Mike Cherim's MIX: Donations gauge. It has the variables $current_amt (the current fundraising total), $goal_level (this year's fundraising target), and a couple of others.

With the one for the fundraising total I've got something nagging at the back of my mind about needing to make the variables global (but I can't remember how to do that, or whether indeed that is the problem). On the other page where I use the script it displays a fundraising thermometer showing the total raised (which rather nicely degrades to just a sentence showing the total with images/CSS off, so works well for accessibility purposes), but on the home page I don't need the thermometer, just the figure. If I don't link the thermometer's stylesheet on the home page I guess that would take care of the "no CSS" which would get the images/CSS off text to display, but that doesn't work for the home page because with no stylesheet for the include, while it displays the fundraising total sentance, the empty thermometer image (without its "mercury") still appears further down the page (and also messes up the layout) as the thermometer image is hard coded into the include script, so using the script but without its stylesheet on the home page isn't an option unfortunately.

With the date of the next bookstall, I know there's a way to get the next [x]day using one of the PHP date functions if I remember rightly (not that I can remember what it is :lol:), but there are certain weeks when there's a holiday or something when the bookstall might not be held, and the dates list include I use on the other page includes a "no bookstall this week" next to the relevant dates in the list where appropriate, so really I want to be able to use that list somehow. The problem is that I can't figure out how I can achieve that.

My PHP skills are somewhat lacking (I know just enough to be dangerous :D). Anyway, that's the background to the problem and what I'm trying to achieve...

It's been suggested to me that I'd be best using a database to store the data, but though I know a bit about MySQL databases (a couple of years ago I did an Open University database course), I've no idea how I'd then access the dates, or the best way to set up the database. I'm thinking that it may be best to combine the dates and fundraising totals in one database so that (in theory) at some point in the future I could use it to track the fundraising totals, but it's how I'd get the data from the database that I'm struggling with.

For the fundraising total I'm guessing that I could get the value pulled from the database to use as the $current_amt variable to use with the thermometer script. I haven't a clue where to start with this though except that I'd need a query to pull off either the current month's dates or the date of the next. If anyone's got any ideas how I could implement these two things they can share with me or a clue to how to start this I'd be most grateful.