Hello.
I'm very new to php since I work with ASP for work all the time, so I am finding a few things slightly strange (but for the most part, PHP is nicer to work with).
Anyway, I have an SQL query which selects a single cell from my table which I need to then set as a variable.
Current code (minus the SQL line):
Code: Select all
$year = $_GET['year'];
if($year == '')
{
$year = 2010;
}Now, I need to replace '2010' with whatever the highest year is in the table (if published), so I would use this line of SQL:
Code: Select all
SELECT MAX(year) FROM photos WHERE pub = '1';Any suggestions?
Thanks, Alan.