[Solved] If statement inside While loop [closed]


You didn’t mention the exact error, but I can see a few: String literals must always have quote marks round them, and also you can’t open a PHP block inside another one, or echo inside an echo.

Just close the php block before you start the HTML, and open it again afterwards for the closing bracket – it will be simpler than sorting all those things out:

<?php if($_SESSION["username"]!= $array[2]) { ?>
  <a class="btn btn-danger delete_user" href="javascript:void(0)" data-id = '<?php echo $row['id'] ?>'>Delete</a>  
<?php } ?>

1

solved If statement inside While loop [closed]