Navigation bar current class change php include

This question already has an answer here: The 3 different equals 4 answers 尝试这个 : <?php $page = ""; if(isset($_GET["page"]) && $_GET["page"] != "") { $page = $_GET["page"]; } ?> <div class="container"> <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" h

导航栏当前类更改php包括

这个问题在这里已经有了答案: 3个不同等于4个答案 尝试这个 : <?php $page = ""; if(isset($_GET["page"]) && $_GET["page"] != "") { $page = $_GET["page"]; } ?> <div class="container"> <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="/womsy/home.php">Wo

PHP executing header:location regardless IF statement parameters

Possible Duplicate: The 3 different equals Can anyone tell me why, when using the code below, I am getting redirected to elephant.com rather than seeing a 'giraffe! <?php $foo="giraffe"; if($foo="elephant"){ header("location:http://www.elephant.com"); exit(); }else{ echo $foo;} ?> Thanks for looking J if($foo="elephant") You're assigning $foo here, rather than comparing i

PHP执行头文件:位置,无论IF语句参数

可能重复: 3个不同的等于 任何人都可以告诉我为什么,当使用下面的代码时,我被重定向到elephant.com,而不是看到'长颈鹿! <?php $foo="giraffe"; if($foo="elephant"){ header("location:http://www.elephant.com"); exit(); }else{ echo $foo;} ?> 感谢您的期待 Ĵ if($foo="elephant") 你在这里分配$foo ,而不是比较它; 你应该这样做: if($foo=="elephant") 赋值操作的结果是刚分配的值; 在这种

Php If else isn't working

This question already has an answer here: The 3 different equals 4 answers $gameum['status'] = '0' // assigns the value '0' to $gamenum['status'] ($gameum['status'] == '0') // compares the two values Your if statement should be if($gameum['status'] == '0' ) { and if you are looking for strict check , i suggest you do if($gameum['status'] === '0' ) { Your are Assigning $gameum['stat

Php如果其他人不工作

这个问题在这里已经有了答案: 3个不同等于4个答案 $gameum['status'] = '0' // assigns the value '0' to $gamenum['status'] ($gameum['status'] == '0') // compares the two values 你的if语句应该是 if($gameum['status'] == '0' ) { 如果你正在寻找strict检查,我建议你这样做 if($gameum['status'] === '0' ) { 你的是将$gameum['status']赋值$gameum['status'] 0 ,如果是条件语句,则添加do

Insert into database table with if else statement in php

This question already has an answer here: The 3 different equals 4 answers This is an assignment, and the expression returns bool(true) : if ($reg_as = "Exporter") To compare the two values, you should use two equal signs: if ($reg_as == "Exporter") Maybe your could do something like this: <form action="reg.php" method="post" enctype="multipart/form-data">

用php中的if语句插入数据库表

这个问题在这里已经有了答案: 3个不同等于4个答案 这是一个赋值,表达式返回bool(true) : if ($reg_as = "Exporter") 为了比较这两个值,你应该使用两个等号: if ($reg_as == "Exporter") 也许你可以做这样的事情: <form action="reg.php" method="post" enctype="multipart/form-data"> <select name="type" id="type"> <option value="importer">Importer&

Identical Strings in PHP not matching

This question already has an answer here: The 3 different equals 4 answers Here is your problem: if ($current == null || $current = "") { // ^ now `$current` is "", an empty string You assign a new value to $current , an empty string. You probably want something like: if ($current == null || $current == "") { // ^^ now you are c

PHP中的相同字符串不匹配

这个问题在这里已经有了答案: 3个不同等于4个答案 这是你的问题: if ($current == null || $current = "") { // ^ now `$current` is "", an empty string 您将一个新值赋给$current ,一个空字符串。 你可能想要这样的东西: if ($current == null || $current == "") { // ^^ now you are comparing

PHP echo with if not working

This question already has an answer here: The 3 different equals 4 answers 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_

PHP回声如果不工作

这个问题在这里已经有了答案: 3个不同等于4个答案 你的if是不正确的。 您必须使用== ,not =来检查PHP中的somethng是否相等。 if($user_post==5) 你必须使用比较运算符:equal == (相同的值)或相同的=== (相同的值和相同的类型)。 您可以探索PHP手册以了解http://php.net/manual/en/language.operators.comparison.php if($user_post=5) 这是赋值运算符,每次它会分配5到$ user_post varibale来改变你的运算符 i

PHP Check if user is Admin

This question already has an answer here: The 3 different equals 4 answers $row["role"] = 1 this is assignment, not comparison. Go for $row["role"] == 1 you're using the OR operator (||), the operator verifies compliance any of the 2 conditions are indicating in the IF statement, for this reason will display the message: "You are a admin!" when any of the

PHP检查用户是否是Admin

这个问题在这里已经有了答案: 3个不同等于4个答案 $row["role"] = 1这是赋值,而不是比较。 去$row["role"] == 1 您正在使用OR运算符(||),运算符会验证符合条件的任何两个条件是否在IF语句中指示,因此,将显示消息:“您是管理员!” 当满足2个条件中的任何一个时。 如果您希望满足2个条件,则向您显示该消息必须使用逻辑AND(&&)来验证IF语句中两个条件的有效性。 if(isset($ _SE

Does variables' order matter when doing == and === comparisons?

This question already has an answer here: The 3 different equals 4 answers It prevents typos which cause very hard to debug bugs. That's in case you accidentally write = instead of == : if ($var == null) # This is true in case $var actually is null if ($var = null) # This will always be true, it will assign $var the value null Instead, switching them is safer: if (null == $var) #

当进行==和===比较时,变量的顺序是否重要?

这个问题在这里已经有了答案: 3个不同等于4个答案 它可以防止错误导致很难调试错误。 这是万一你不小心写=而不是== : if ($var == null) # This is true in case $var actually is null if ($var = null) # This will always be true, it will assign $var the value null 相反,切换它们更安全: if (null == $var) # True if $var is null if (null = $var) # This will raise compiler (or parser) error, a

Simple PHP If / ElseIf statement not working

This question already has an answer here: The 3 different equals 4 answers You are using = instead of == for the last cases. This will always be true since this is an assignation. Replace those by == and you're good to go. Careful with = and == . I think that is the problem. if ( $title == 'New York' ) { echo 'This is New York'; } elseif ( $title ==

简单的PHP如果/ ElseIf语句不起作用

这个问题在这里已经有了答案: 3个不同等于4个答案 您在最后一种情况下使用=而不是== 。 由于这是一项任务,因此这将始终如此。 用==代替这些,你很好。 小心使用=和==。 我认为这是问题。 if ( $title == 'New York' ) { echo 'This is New York'; } elseif ( $title == 'California' ) { echo 'This Is California'; } else if ($title == "Chica

What is the difference between == and === in php

Possible Duplicate: The 3 different equals Is there any difference between == and === in php? both seem to work fine for me when i use them in a conditional statement. I am very new to programming in PHP. Please consider this and answer in simple words. $a == $b Equal true : if $a is equal to $b , after type juggling. $a === $b Identical true : if $a is equal to $b , and they are o

在PHP中==和===有什么区别

可能重复: 3个不同的等于 在PHP和==之间有没有区别? 当我在条件语句中使用它们时,它们似乎都适用于我。 我对PHP编程非常陌生。 请考虑这一点,并用简单的话来回答。 $a == $b 同样如此 :如果$a等于$b ,那么在玩杂耍之后。 $a === $b 同样如此 :如果$a等于$b ,并且它们是相同的类型 。 相同: $a === $b 如果$a equal $b ,并且它们是相同类型, $b TRUE 。 (在PHP 4引入) 等于: $a == $b