草庐IT

CodeIgniter-combobox

全部标签

php - 分页在带有 url_suffix 的 codeigniter 2.1.0 中无法正常工作

我正在使用codeigniter2.1.0和mysql数据库。在我的管理面板中,我有一个页面,我想在其中向所有用户显示分页View。但它不工作。在尝试了很多东西之后这是我的更新代码Controller:functionaccounts()//controllertoviewallusers{$this->load->library('pagination');$config['base_url']=site_url('admin/home/accounts/');$config['total_rows']=$this->db->get('user')->num_rows();$conf

php - Codeigniter Active Record HAVING/WHERE db.field = db.field

谁能告诉我,这是否可以通过事件记录来实现?如何实现?$this->db->select('*');$this->db->from('table1');$this->db->join('table2','table1.id=table2.fi_id','left');$this->db->having('table1.second_id','table2.fi_second_id',false);$query=$this->db->get();问题在于,'table2.fi_second_id'始终被视为字符串-而不是数据库字段。也用'where'试过这个-这是同样的问题。谢谢

php - Codeigniter 中的安全类

我正在尝试使用Codeigniter2.0.2中的Security类,但我似乎无法找到要加载的类。它隐藏在某处吗?如CI用户指南中所示的安全库:http://codeigniter.com/user_guide/libraries/security.html尝试搜索/system/libraries但它不在那里...尝试使用$this->load->library('security')加载安全类;给我一个错误:Unabletoloadtherequestedclass:security 最佳答案 根据codeigniteruser

php - 在 codeigniter 中通过查询转义订单

这是运行的SQL查询:SELECT*FROM(`news`)WHERE`country`ISNULLAND`region`ISNULLORDERBYIFNULL(update_date,`create_date)`DESC你可能会注意到create_date有一些格式错误,我想禁用转义,但即使我在order_by函数之后添加false它也没有效果。如何解决?非常感谢$this->db->select('*');$this->db->from('news');$this->db->where($data);$this->db->order_by('IFNULL(update_date,c

php - 如何在 CodeIgniter 中执行 "while fetch assoc"?

什么是等价的makecodeignitergetandwriteallvariables...这是我通常会做的事情:$get=mysql_query("SELECT*FROMaTable");while($row=mysql_fetch_assoc){echo$row['someContent'];}我如何在codeigniter中执行此操作? 最佳答案 运行查询后,使用->query()或“事件记录”类->get(),使用result_array方法。$query=$this->db->query("SELECT*FROMaTab

php - 仅从 codeigniter 中的列中选择唯一值

我有一张这样的tablename|subjects|location......................BUET|CSE|DhakaBUET|EEE|DhakaRUET|CE|RajshahiRU|CE|Rajshahi这里所有的行都是不同的。如果我使用$this->db->select('*')and$this->db->distinct()它会选择BUET的所有行,但我只想这样name|subjects|location......................BUET|CSE|DhakaRUET|CE|RajshahiRU|CE|Rajshahi这意味着只有第一列必须是

php - 如何使用 dbforge[of codeigniter] 添加外键

我正在使用codeigniter,我正在尝试将以下查询转换为dbforge样式查询,我该怎么做?createtablefilter(filteridintprimarykeyauto_increment,filternamevarchar(50)notnull,categoryidintnotnull,isactivetinyintnotnull,sequenceintnotnull,foreignkey(categoryid)referencescategory(id)); 最佳答案 这里有4种方法可以做到这一点。前三个与crea

php - 如何从 CodeIgniter 中失败的数据库查询中恢复?

在CodeIgniter中,如果您的sql查询失败,那么脚本将停止运行并且您会收到错误消息。有什么方法可以让您尝试一个查询,如果失败了,那么您会默默地检测它并在用户不知道查询失败的情况下尝试不同的查询? 最佳答案 您可以修改Exceptions类以...抛出异常。只需在application/core/中创建MY_Exceptions.php:classMY_ExceptionsextendsCI_Exceptions{functionshow_error($heading,$message,$template='error_gen

php - 不等于mysql查询codeigniter中的条件

这是我的型号代码:publicfunctionselect($id){$this->db->select('Something');$this->db->from('tbl_somthing');$this->db->where('tbl_somthing.User_id',$id);$this->db->where('tbl_somthing.Something',0,FALSE);$query=$this->db->get();return$query->result();}如何从字段中选择非零值?上面的查询不起作用。 最佳答案

mysql - Codeigniter - 对从 MySQL 中检索到的值进行排序

是否可以对从MySQL检索到的值进行排序,比如降序id?谢谢。 最佳答案 给你...$this->db->select("*");$this->db->from("table");$this->db->order_by("id","desc");$this->db->get();阅读更多信息codeigniterdocumentationforactiverecordclass. 关于mysql-Codeigniter-对从MySQL中检索到的值进行排序,我们在StackOverflow