包含if else条件的文件

时间:2014-08-02 22:01:38

标签: php mysql

我包括payment.php,但仅在if图像类型等于“map”的情况下,否则其他html内容不包括payment.php。

例如

<?php
include('aaa.php');
$url=$_GET['url'];
$sql = "SELECT * FROM maps WHERE url='$url'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
    {
        $name=$row['name'];$metaTitle=$row['metaTitle'];$metaDesc=$row['metaDesc'];$metaKeyword=$row['metaKeyword'];$imageType=$row['imageType'];
?>

出现一些内容。我需要为下面的行编写php代码

if imageType(name of field in table)= map
then include external file "payment.php"
else
html content without indluding payment.php file.

1 个答案:

答案 0 :(得分:2)

if($imageType == "map") {
    include('payment.php');
}
//html content here
相关问题