大家好,我不知道什么是call if或switch语句。
我有数据库表字段,这是调用价格,所以我想让如果价格,如果价格字段空它的显示"请打电话给我们的价格",如果价格字段不是它的,我将显示我把它。
这是我的代码,但我不知道为什么它不工作。任何人都可以帮忙thanks you
<?php
$result = mysql_query("SELECT * FROM articles where articlefriendlyURL='%s'",mysql_real_escape_string($aid));
while($row = mysql_fetch_assoc($result)) {
if ($row['price']; = = '') {
echo ("Please Call Us for the price");
else {
echo $row_getArticle['price'];
}
}
}
?>
不能将等号分开,否则就不再是检查等号的条件语句了。括号中的if/else也有语法错误。试试这个:
<?php
$result = mysql_query("SELECT * FROM articles where articlefriendlyURL='%s'",mysql_real_escape_string($aid));
while($row = mysql_fetch_assoc($result)) {
if (empty($row['price'])) {
echo ("Please Call Us for the price");
} else {
echo $row['price'];
}
}
?>
我认为问题出在
if ($row['price']; = = '0')
我认为该语句的正确语法是
if ($row['price'] == '0')