我希望当 PDF 字段为空时隐藏 PDF 字段,我已经搜索了这个论坛和许多其他论坛,我阅读的越多,我就越困惑!
我已经在====
之前和之后标记了有问题的区域!
这是我的代码:
<?php
$id = $_GET['id'];
if(empty($id))
header('Location: news.php');
else
{
mysql_connect('localhost','root','usbw');
mysql_select_db('flexphpdir');
$query = mysql_query("Select * From linkex WHERE linkexid = '$id'");
if($query === false)
{
var_dump(mysql_error());
}
else
{
while($output = mysql_fetch_assoc($query))
{
?>
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="320" height="184" data-setup="{}">
<?php echo $output['title']; ?><br>
<?php echo date('d-M-Y', $output['adddate']); ?><br>
<?php echo $output['weekid']; ?>
<source src="contentuploads/<?php echo $output['video']; ?>" type="video/mp4" />
</video>
//================================
<?php if (get_field('pdf') != "") { ?>
//code if field has value ! = <?php echo $output['pdf']; ?>
<?php } else { ?>
//code for no field value here
<?php } ?>
//=================================
<?php
}
}
?>
<?php } ?>