i hava a query of the following form
select * from tablename where id= $var
now sometimes i need to select a recod with a particular id ,and sometimes i need to select recore with any id
so i intent to something of follwoing form
$v = $_GET['id'];
if($v== -1)
$var = '*' //here i want to select all recods
else
$var = $v //select record recod with specifinc id
//execure the SQL query now
select * from tablename where id= $var
but SQL dont support it when $var = *
How can this problem be solved by using the above technique NOTE: Actial scenirio is very different and complex so i have just give a simple eg for others to get to know my requiremnt I know that the above thing can be handled in many diffret appooaches But i want to solve it in the above descibed approach