Conditional style for specific data in PHP |
Currently I have a table displaying all of the agents and a count of their leads status shown in the same row. Now these agents can be Active or Inactive, but both are shown in my table. This active/inactive status is shown in my users table under the status column as either Y or N. Now this is the code I'm using to get my data:
Model Class: Code: function get_agentsreport(){ View Class: Code: <?php Now I'm trying to differentiate the active and inactive users by a change in the style and as shown here I've tried if($grplead['status'] == "N"){$inactive_status == true;} but in my table it always goes to the else statement and doesn't compute the first if statement. I've also tried if($grplead['status'] == "Y"){$inactive_status == true;} but it gives the same output. I've tried logging this status by print_r($grplead['status']); which gave the correct result like YYYYNY. So it is giving the correct status for each person, but for some reason it does not work in my if condition
The bug is here :
PHP Code: if($grplead['status'] == "N"){ $inactive_status is never initialized. There should only be one equal sign, and it should be set to false if status is not equal to N : PHP Code: if($grplead['status'] == "N") { …and could be simplified like this : PHP Code: $inactive_status = ($grplead['status'] == "N");
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |