gpt4 book ai didi

php - Codeigniter -> 使用 empty_table 的函数

转载 作者:行者123 更新时间:2023-11-29 01:10:18 25 4
gpt4 key购买 nike

我正在尝试清空表格,但我想知道我的功能是否正确?

型号:

public function removeQuote()
{
$this->db->empty_table('companyDetails,hostingDetails,layoutDetails');
}

Controller :

public function submit()
{
$data['companyContact'] = $this->quote->getCompanyDetails()->companyContact;

$this->load->view('submit',$data);

$this->quote->removeQuote();
}

错误:

Table '_quote.companyDetails,hostingDetails,layoutDetails' doesn't exist

DELETE FROM `companyDetails,hostingDetails,layoutDetails`

最佳答案

/**
* Empty Table
*
* Compiles a delete string and runs "DELETE FROM table"
*
* @param string the table to empty
* @return object
*/
public function empty_table($table = '')

显然你不能这样做

$this->db->empty_table('companyDetails,hostingDetails,layoutDetails');

相反,您必须调用 empty_table 三次:

$this->db->empty_table('companyDetails');
$this->db->empty_table('hostingDetails');
$this->db->empty_table('layoutDetails');

您可以随时破解 CodeIgniter DB_active_rec.php 文件,使其满足您的需求。

关于php - Codeigniter -> 使用 empty_table 的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10067671/

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