我还是非常新的PHP并且需要将现有页面转换为php,有人能告诉我如何将下面的代码转换为php吗?
<%If rsMembership.Fields.Item("MemberOfGroup").Value = "0" then response.write ("Main Member")Else response.write ("Belongs to Member = ")&(rsMembership.Fields.Item("MemberOfGroup").Value)End if%>
更新:这有效,不确定它是否正确,似乎无法将值设为=“0”,只有当我把&lt;“1”
时才有效 <?php
if ($row_rsMembership['MemberOfGroup']< "1")
{
echo "Main Member";
}
else
{
echo "Belongs to Member =" . $row_rsMembership['MemberOfGroup'];
}
?>
答案 0 :(得分:1)
要比较PHP If语句中的值,请使用==而不是=,即:
if ($row_rsMembership['MemberOfGroup'] == "0")
{
echo "Main Member";
}
else
{
echo "Belongs to Member =" . $row_rsMembership['MemberOfGroup'];
}