Php 在不显示数据库信息的情况下回显表信息CodeIgniter

Php 在不显示数据库信息的情况下回显表信息CodeIgniter,php,codeigniter,codeigniter-3,Php,Codeigniter,Codeigniter 3,我在CodeIgniter中创建了一个函数,这样我就可以打印来自两个不同表的数据库信息,并用数组显示在我的视图页面上。现在我在打印时遇到的问题是,它显示了所有信息,包括行名称等 它在“我的视图”页面上显示如下: Array ( [0] => Array ( [user_id] => 6 [email] => jeremy2@gmail.com [voornaam] => Jeremy [product_id] => 73 [category_id] => 3

我在CodeIgniter中创建了一个函数,这样我就可以打印来自两个不同表的数据库信息,并用数组显示在我的视图页面上。现在我在打印时遇到的问题是,它显示了所有信息,包括行名称等

它在“我的视图”页面上显示如下:

Array ( [0] => Array ( [user_id] => 6 [email] => jeremy2@gmail.com [voornaam] => Jeremy [product_id] => 73 [category_id] => 3 [product_naam] => Tennisracket ) ) jeremy2@gmail.com Jeremy Tennisracket
<?php print_r($userdetail_list); 
        foreach($userdetail_list as $row)
                        {
                        ?>
                        <tr>
                            <td><?php echo $row['email'];?></td>
                            <td><?php echo $row['voornaam'];?></td>
                            <td><?php echo $row['product_naam'];?></td>
                         </tr>
       <?php } ?>
我只想让它呼应这样的名字:

**jeremy2@gmail.com Jeremy Tennisracket**
我的查看页面:

Array ( [0] => Array ( [user_id] => 6 [email] => jeremy2@gmail.com [voornaam] => Jeremy [product_id] => 73 [category_id] => 3 [product_naam] => Tennisracket ) ) jeremy2@gmail.com Jeremy Tennisracket
<?php print_r($userdetail_list); 
        foreach($userdetail_list as $row)
                        {
                        ?>
                        <tr>
                            <td><?php echo $row['email'];?></td>
                            <td><?php echo $row['voornaam'];?></td>
                            <td><?php echo $row['product_naam'];?></td>
                         </tr>
       <?php } ?>
我的模型功能:

   public function details($product_id)
 {
  //load the Product_model
  $this->load->model('Product_model');

  //call function getdata in de Product_model
  $data['userdetail_list'] = $this->Product_model->getdata();

  //get product details
  $data['product'] = $this->Product_model->get_product_details($product_id);

  //laad view
  $data['main_content'] = 'details';
  $this->load->view('details',$data);
 }
 public function getdata()
{
    $this->db->select('users.user_id,users.email,users.voornaam,products.product_id,products.category_id,products.product_naam');
    $this->db->from('users');
    $this->db->join('products','products.user_id = users.user_id');
    $query = $this->db->get();
    if($query->num_rows()>0)
    {
       return $query->result_array();
    }
}

您有一个很简单的愚蠢错误,您正在打印整个数组
print\r($userdetail\u list)只需删除该部分。

您应该删除
print\r($userdetail\u list)在您的视图中