草庐IT

codeigniter-2

全部标签

php - Codeigniter:this->datatables->select(sample)->from(sample)->where()

请帮帮我。我无法正确使用我的数据表。我想做的是从表中选择并使用where函数。但我做不到。这是我的Controller代码publicfunctionreporttable(){$zz=array('empnumber'=>$this->input->post('empnumber'));//$this->db->order_by("surname","asc");$this->datatables->select('date_auto,particulars,earned_VL,aul_VL,balance_VL,aulx_VL,earned_SL,aul_SL,balance_SL

javascript - 使用 jquery 的 CodeIgniter 动态输入并插入到数据库

我偶然发现了一个关于我friendCI项目的问题:他想添加一个新的标记到正文并插入到MySQL,所以我编写了这段代码:»AddEducationalBackground.....Controller:$this->load->view('welcome_message');$this->load->model('test');if($this->input->post('attain',true)!=null){foreach($this->input->post('attain',true)as$a){foreach($this->input->post('major',

php - 无法检索数据以使用 codeigniter 通过电子邮件发送

我以前也遇到过类似的问题,但它已经解决了,但即使在了解了它是如何做到的之后,还是很困惑。所以我有一个写在Controller上的函数,它从MySQL数据库接收数据并使用代码点火器函数发送电子邮件。所以这是Controller代码publicfunctionsendEmailToNewBorrower(){//fetchthadatafromthedatabase$this->load->model('payment_plan');$foo=$this->payment_plan->getInfoToNotifyBorrowerForNewLoan();$result=json_deco

php - 单击提交 codeigniter 后找不到对象(错误 404)

每次我单击登录提交按钮时,它都会转到“找不到对象”错误404!几个小时以来,我一直在查看我的代码,但找不到正确的解决方案。请帮忙!谢谢!登录Controller.phpload->view('template/header');$this->load->view('login_view');echo"alert('x');";}publicfunctionlogin(){$email=$this->input->post('email');$password=$this->input->post('password');$successful=$this->login_model->l

php - CodeIgniter 中的分页问题

我的系统中存在分页问题。分页在这里工作正常。但是如果我在该文本字段中搜索某些内容并且结果超过5个($config['per_page']=5;),它不会显示分页按钮。实际上,搜索关键字“shihas”有6个结果。一旦我转到www.example.com/path/2,我也可以看到第6个结果。但是,分页链接仍然不存在。请告诉我这个问题的解决方案。Controller:publicfunctionindex(){//allthepostssentbytheview$search_string=$this->input->post('search_string');$order=$this-

php - 从 PHP codeigniter 模型返回的结果集中获取单个值

我正在使用codeigniter框架和MVC架构开发PHPStorm。我的模型中需要一个函数来查询数据库中的sysuser表,并在传递用户名时返回uid(用户ID)。sysuser表结构+---------------+----------------+-----------------+|uid|name|username|+---------------+----------------+-----------------+|1|kim|kcdla|+---------------+----------------+-----------------+|2|Sam|sammyG|+

php - 在 CodeIgniter 上创建 json 编码时无法分组

我正在尝试从mysql数据库对json进行编码,并使用CodeIgniter连接表,但我想将输入相同的数据合并为一个,但发生了group_by错误。怎么了?错误提示Expression#1ofSELECTlistisnotinGROUPBYclauseandcontainsnonaggregatedcolumn'project.mytb1.id'whichisnotfunctionallydependentoncolumnsinGROUPBYclause;thisisincompatiblewithsql_mode=only_full_group_by我的脚本functionget_i

php - Codeigniter 数据库加入额外的变量

我想加入两个表,但比较是与外部变量,如$ext_user$this->db->join('ec_details2','ec_details.user_id=ec_users.user_id','INNER');我想使用$ext_user而不是上面代码中的ec_users.user_id,我该如何像下面那样做?$this->db->join('ec_details2','ec_details.user_id=$ext_user','INNER');如果我使用第二个选项,它不会将$ext_user作为变量,而是作为完整的字符串!谢谢, 最佳答案

php - 比较表中的前 4 个字符并从 codeigniter 中的数据库中获取数据

我有两个不同的表作为testimonial和pagetitles。从database获取Pagetitles时。我需要比较前4个字符,如果两者都匹配,那么我应该获取数据。functiongetpagetitle($id){$this->db->select('P.*,T.testimonial_name');$this->db->from('pagetitleASP');$this->db->join('testimonialsAST','SUBSTR(T.testimonial_name,4)=SUBSTR(P.page_title,4)','INNER');$this->db->w

php - 是否可以在 CodeIgniter 中使用手动 SQL 查询?

我一直在学习codeigniter,我喜欢他们的数据库方法。但是我更愿意编写自己的SQL查询。当我尝试编写手动查询时,它会导致codeigniter错误。如果可能的话,我已经四处搜索了,但是我找不到关于这个主题的太多信息。我得到了答案wasthis.问题是否可以禁用Codeigniter数据库方法中的构建,并执行我自己的sql查询。或者在CodeIgniter的数据库类旁边运行我自己的sql查询?如果是,我将如何配置它?提前致谢 最佳答案 来自https://www.codeigniter.com/userguide3/databa