mardi 21 avril 2015

multiple if in if with get url

i want to select from database by url and for this i do this if:

    if (isset($_GET['class']) == 'dw')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [dw] > 0 order by credits asc");
}
if (isset($_GET['class']) == 'bk')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [bk] > 0 order by credits asc");
}
if (isset($_GET['class']) == 'fe')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [fe] > 0 order by credits asc");
}
if (isset($_GET['class']) == 'mf')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [mf] > 0 order by credits asc");
}
if (isset($_GET['class']) == 'dl')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [dl] > 0 order by credits asc");
}
if (isset($_GET['class']) == 'sum')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [sum] > 0 order by credits asc");
}
if (isset($_GET['class']) == 'rf')
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' and [rf] > 0 order by credits asc");
}
else
{
    $query  = mssql_query("select * from [WebShop] where [category]='".secure($string)."' order by credits asc");
}

Url for this is: index.php?sy=items&class=dw

but when i access this url index.php?sy=items&class=dw is selected last if :( : index.php?sy=items&class=rf

can help me to resolve for work with each if ?

Aucun commentaire:

Enregistrer un commentaire