Wasn't quite sure what to do for a title on this one, anyway...

number_format(getNetDonations(date('%')) + 23.97, 2)

I'm using the above to try and pull total donations ever received on my site but here's where it gets hinky. There's safety checks in the code "or so I'm told by the author" to prevent wild cards from being used. Well, the dates in the row it's trying to pull from are in a format of date('F Y').

ex. November 2010 , September 2009 etc. etc. etc.

Well, I can't seem to pull anything but current month totals by either using

number_format(getNetDonations(date('F Y')) + 23.97, 2)

or

number_format(getNetDonations('November 2010') + 23.97, 2)

So I decided to try and go with something like below...

$date = whatever ;

number_format(getNetDonations($date) + 23.97, 2)

But I don't know what to use for the whatever... so, here's my question...

Regardless of how it is done I basically need to ignore the values in the row where the dates are stored in the named format (November 2010 etc.). So, anyone got any ideas on this. The code author has given one suggestion which I will quote below but I wouldn't know how to write said loop.

--- Begin Quote ---
It's probably not going to work with a wildcard without taking out the safety checks in the getNetDonations function, but the wildcard is % instead of * in SQL. You might need to write a loop to call the getNet. for each month from the start date until the current month.
--- End Quote ---

I'm guessing he meant something like writing a loop that uses the below with a set start date but no real end date.

getNetDonations(date('F Y'))

And then taking all of the figures gathered and making one big total which as of right now should be like $61.90

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.