Such a problem: in the database table there is a status string in it I can write banned and active accordingly. It is necessary that the main page (php-файл) displays information for each type of a perfect: that is for the banned echo '<h1>Извините вы забанены</h1>'; and for activated echo '//содержание скрипта'; How to do this with the $status variable?
|
1 answer
I recommend using a different approach.
status field with type tinyint and length of value 1, default 0
0 will mean that the user is active, if you change the value to 1 in this case, the user is banned and then the code will be like this:
if ($status) { echo "<h1>Извините вы забанены</h1>"; } else { echo "<h1>Ваш аккаунт активен</h1>"; } - Question: What should be the string? varchar? - Nikita Skull
- corrected the answer. - verstala
- Thanks, but the first option came up to me, where if ($ user ['status'] == "admin") {<a href=""> ADMINPANEL </a>} else {} - Nikita Skull
|