草庐IT

codeigniter-helpers

全部标签

php - Codeigniter 多维数组插入数据库

你好,我正在尝试使用codeigniter将多维数组插入mysql。我在正确输入值时遇到了一些麻烦。这是多维数组的样子Array([2]=>Array([A]=>FName2[B]=>LName2[C]=>PhoneNo2[D]=>FaxNo2)[3]=>Array([A]=>FName3[B]=>LName3[C]=>PhoneNo3[D]=>FaxNo3)[4]=>Array([A]=>FName4[B]=>LName4[C]=>PhoneNo4[D]=>FaxNo4)[5]=>Array([A]=>FName5[B]=>LName5[C]=>PhoneNo5[D]=>FaxNo5

php - 插入行时,Codeigniter affected_rows 总是返回 0

我正在对表执行插入操作,只有在更新插入正确时脚本才会继续。if($this->db->affected_rows()>0){}在我的应用程序中的其他地方工作得很好,但由于某种原因,它在某一时刻没有并且总是返回0片段如下while($asked_order_amount_needed>0){$matches_attempted=0;$matched_orders=$query->result_array();foreach($matched_ordersas$matched_order){//wecanfillthesubmittedordercompletelywithamatched

php - 如何从 codeigniter 中的多个选择下拉列表中将数据插入数据库?

我有下拉菜单,如下所示MENTALHEALTHSUICIDESUPPORTHEALTHSUPPORT在我的Controller中,我有以下代码从下拉列表中获取数据publicfunctionsave(){$ctgry=($this->input->post('category'));$orgName=($this->input->post('InputName'));$streetNo=($this->input->post('StreetNo'));$streetName=($this->input->post('StreetName'));$suburb=($this->input

php - 在 codeigniter View 中嵌套 foreach

我有4个表:process、country、process_country和category。每个进程都属于某个类别。一个国家可能有几个可用的过程,一个过程可能在多个国家可用。下面是我的数据库结构:categorytableprocesstablecountrytableprocess_country--------------------------------------------------------categoryidprocessidcountryidcountryidcategorynameprocessnamecountrynameprocessidcategoryi

php - Codeigniter - 子查询中的值被忽略

不确定我的查询哪里出错了,但是值dateread被忽略了,我得到了一个errorMessage:Undefinedproperty:stdClass::$dateread.SELECT`id`.`id`,`id`.`name`,`id`.`deleted`,`id`.`filepath`,`id`.`createddate`,(SELECTcreateddateasdatereadFROMdocuments_usersiuWHEREid.id=iu.docs_idANDiu.users_id=2346)FROM(`documents`ASid)JOIN`documents_years`

php - 在 Codeigniter 中将旧的程序化 PHP 函数转换为模型- View - Controller (MVC)

我是模型-View-Controller的新手,我开始在Codeigniter中编码。我基本上是将我的项目转换为MVC,但是,我遇到了这个函数(如下),我想将其拆分为MVC。我有100个这样的函数,如果我找到最好的方法,我将能够自己将其余函数转换为MVC。此功能集PHP、Mysql和HTML于一身。就像我们分别拆分查询和HTML一样,我也想使用Codeingiter框架来完成。即使您不能使用codeigniter默认函数回答,也请告诉我如何拆分。这里是:$fetch_projections=mysql_query("SELECTissue_id,emp_name,employeeId,

php - 使用 Codeigniter 的多语言数据库

我在数据库设计中应用了AdditionalTranslationApproach方法。使用这种表结构,每个查询的代码变得更加复杂。我在模型中的PHP代码:db->select('m.id,m.title,m.content');$table='blog';if(MULTILINGUAL){$this->db->from($table.'ASm');$this->db->select('t.title,t.content');$this->db->join($table.'_translationASt','m.id=t.parent_id','left');$this->db->whe

php - CodeIgniter 将字符串附加到表名

在我的codeIgniter项目中,每个用户都有单独的表。例如,tbl_user1、tbl_user2、tbl_user3、tbl_user4等。这1、2、3、4是用户ID号。特定用户登录系统后,我需要访问与用户相关的表。(例如,对于用户2,需要从tbl_user2表中获取数据)。我有包含用户ID的session变量,$uid=$this->session->userdata('uid');//$uid=2for**user2**如何将其与我的模型和Controller一起使用,例如。Controller$this->tbl_user('用户名');//$this->tbl_user.

php - 在Codeigniter中如何提高Rest Web service Mysql的性能?

我有一个表,其中有一列用于存储Facebookid、消息等...现在我有1000条记录。这是我的表结构。CREATETABLEIFNOTEXISTS`user_notification`(`id`int(11)NOTNULLAUTO_INCREMENT,`facebook_id`varchar(20)NOTNULL,`preference_id`int(11)NOTNULL,`notification_id`int(11)NOTNULL,`message`textNOTNULL,`status`int(11)NOTNULLCOMMENT'0meansunread1meansread',

php - 如何在 Codeigniter 的 View 中使用两个表数据

我有两个表,第一个表是关于主题名称的,第二个表显示的是子主题。我想从第一个表主题名称开始显示,然后搜索相应的子主题并将其显示在View中,依此类推,直到在第一个表中找到主题名称。但问题是我只能在View中获取一个表数据,即主要主题表。我不知道如何获取两个表的完整数据并使用它。DatabaseStructure:Model:load->database();$this->db->select("*");$this->db->from("topics");$query=$this->db->get();return$query->result();}}?>Controller:load->