我无法检查数据库中是否存在行,如果没有显示消息。代码如下。我需要一些帮助。
<?php
$result = mysqli_query($mysqli, "SELECT client_cv FROM formular_client WHERE id = '$id'");
if (mysqli_num_rows($result) > 0){
echo "<a href='../cv/" . $rows['client_cv'] . "' target='_blank' class='btn btn-lg btn-primary'><span class='glyphicon glyphicon-download-alt'></span> Descarca CV</a>";
} else {
echo "<a href='#' target='_blank' class='btn btn-lg btn-primary'><span class='glyphicon glyphicon-download-alt'></span> Fara CV</a>";
}
?>
答案 0 :(得分:0)
如果您想根据$res= $this->property_model->get_all_array("SELECT reg_date as date,f_name,id as id from register order by reg_date desc");
$res1= $this->property_model->get_all_array("SELECT payment_date as date,history_id,r_id as id from payment_history order by payment_date desc");
$data['activity'] = array_merge($res,$res1);
foreach ($activity as $key => $row) {
$volume[$key] = $row['date'];
}
// Sort the data with volume descending, edition ascending
// Add $data as the last parameter, to sort by the common key
array_multisort($volume, SORT_DESC, $activity);
是否有值显示不同的链接,请尝试使用
client_cv