We have a list of dates that is drawn from a MySQL database. That part is pretty straight forward and works just fine, do a $query, step through the array, find those that meet conditions, echo some html code and the date itself.
The issue we are hoping to remedy is that this list appears in three separate places on the webpage. Each time it appears, the php code is run, database query made and results echo'd.
What I am wondering is if there is a way to create a php variable at the beginning and then simply echo that variable in all three spots, rather than running the code three times.
I have tried the noob ideas of simply using:
$date = ( ...all the php query / echo code... );
and
$date = { ...all the php query / echo code... };
As well as permutations there of. But to no avail.