PHP echo with if not working
This question already has an answer here:
your if is not correct. You must use == , not = to check if somethng equals in PHP.
if($user_post==5)
You have to use comparison operator: equal ==
(same value) or identical ===
(same value and same type).
You can explore php manual for learning http://php.net/manual/en/language.operators.comparison.php
if($user_post=5)
this is assignment operator each time it will assing 5 to $user_post varibale change your operator to
if($user_post == 5)
or
if($user_post ==== 5)
The difference is frist one will check value only and 2nd one will check its type I hope it will help you
链接地址: http://www.djcxy.com/p/58464.html上一篇: PHP中的相同字符串不匹配
下一篇: PHP回声如果不工作