Alvaro Cobo wrote:
> Thanks Pooly and Peter:
>
> The problem is that in the same php page I would like to choose either the
> calculation from an especific year or the calculation from the whole table
> using URL.
The same page can easily handle both.
<?php
$sql = "SELECT * FROM mytable";
if(isset($_GET['year']) && !empty($_GET['year'])) {
$sql .= " WHERE year=" . intval($_GET['year']);
}
$result = mysql_query($sql);
?>
If year is passed as a GET variable then it will retrieve only records
with that year in the table. If it's not passed then it will retrieve
the whole table by omitting the WHERE clause.
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/