gpt4 book ai didi

php - 如果行状态为 1 个使用 CodeIgniter 在 View 上批准的输出

转载 作者:行者123 更新时间:2023-11-29 07:15:33 24 4
gpt4 key购买 nike

如果表行列状态为1,我想输出您已批准的语句。能够从数据库输出数据。现在我只想输出语句。

我的 Controller

public function index(){

$this->load->database();
$this->load->model('Truckeraccount_model');
$data['account_details']=$this->Truckeraccount_model->account_details();
$this->load->view('header');
$this->load->view('truckers/truckeraccount_view', $data);
$this->load->view('footer');

}

我的模型

public function account_details() { 

$this->db->select('*');
$this->db->from('trucker');
$query = $this->db->get('trucker');
return $query;

}

我的观点

  <?php
foreach ($account_details->result() as $row)
{
?>
Area - <?php echo $row->area;?><br>
Mobile Number - <?php echo $row->phone_number;?><br>
Address - <?php echo $row->address;?><br>
Email Address - <?php echo $row->email_address;?><br>
Status - <?php echo $row->status;?><br>

<?php } ?>

最佳答案

使用这样的if语句,

<?php
foreach ($account_details->result() as $row)
{
?>
Area - <?php echo $row->area;?><br>
Mobile Number - <?php echo $row->phone_number;?><br>
Address - <?php echo $row->address;?><br>
Email Address - <?php echo $row->email_address;?><br>
Status - <?php if($row->status == 1) { echo 'you are Approved'; }?><br>

<?php } ?>

关于php - 如果行状态为 1 个使用 CodeIgniter 在 View 上批准的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38080722/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com