php - A better way to check if a user were logged in and generate like dislike link -
i have script takes 500 rows table, , based on whether or not user logged in, generates link or dislike item.
the way goes this:
//select * table; //while(){ if($userlogged) { echo $row['columnname'].' - dislike'; }else{ echo $row['columnname']; } }
this way, checks if user logged @ each , every row. $userlogged
set in file that's included on page. better way instead of checking if user logged in inside loop each , every row?
not getting question quiet think want prevent condition each time loop can check condition first , loop accordingly, example
if($userlogged) { while(condition) { } } else { while(condition) { } }
this way don't have check condition inside loop each time loops
Comments
Post a Comment