0

我正在使用CodeigniterwithGrocery Crud连接和中的MySQL数据库PhpMyAdmin

我按照教程所说安装了所有东西,但错误总是存在。

我的问题是:我有一个简单的表(3 个字段,一个用于姓名,另一个用于姓氏,另一个用于出生日期),varchar (255)用于前两个和DATE出生日期。当我添加新记录或更新现有记录时,它说它成功地完成了这项工作,但实际上并没有。并且只有在DATE场上。我可以完美地添加和更新其他 2 列。

有任何想法吗?

编辑:我按要求添加了代码。这是Controller获得患者的原因:

<?php if (!defined('BASEPATH'))
    exit('No direct script access allowed');
class GetPatients extends CI_Controller
{

    function __construct()
    {
        parent::__construct();

        $this->load->database();
        $this->load->helper('url');

        $this->load->library('grocery_CRUD');
    }

    public function index()
    {
        echo "<h1>Welcome to the world of Codeigniter</h1>"; //Just an example to ensure that we get into the function
        die();
    }

    public function dbpatients()
    {
        $this->grocery_crud->set_table('patient');
        $output = $this->grocery_crud->render();

        $this->_example_output($output);
    }

    function _example_output($output = null)
    {
        $this->load->view('patients_view',$output);
    }

}
4

1 回答 1

1

mysql date col 仅支持数字或字符串作为赋值值。你可以转换你的日期格式

$datestring = "%Y%m%d";
    $time = time();
    $date = mdate($datestring, $time);
于 2013-11-30T12:36:06.470 回答