vendredi 9 mars 2018

Is it possible to add a parameter in an IF condition?

I'd like to display data from tables. Some user may have only certain data. I have this parameter:

if($person == "nonmember"){
    $st_show = ' == 3'; //For non member show rows with status of 3
}else{
    $st_show = ' <> 3'; //For member show rows with status of not 3. Status may dynamically increased and changed
}

How can I loop the rows based on the parameter above. Something like this :

if($rows->STATUS echo $st_show){
    //show data based on $person
}

I know it returns an error. Are there any solutions for me beside than do these limitation in database?

Aucun commentaire:

Enregistrer un commentaire