codeigniter

php codeigniter count rows

喜夏-厌秋 提交于 2020-01-30 04:09:57
问题 I am new in codeigniter, I want to count all rows from database table but the query dose not retrieve the exact total of rows. Here is Model public function countRow(){ $query = $this->db->query("SELECT *,count(id) AS num_of_time FROM home"); // print_r($query->result()); return $query->result(); } and this is the controller public function countTotalrow(){ $data['query'] = $this->home_model->countRow(); } this is the view foreach ($num_of_time as $row){ <span><?php print_r($row->id);?></span

CodeIgniter Active Record Where Not In String

强颜欢笑 提交于 2020-01-30 04:09:11
问题 I'm having an issue with CI Active Record's " Where Not In ". I am trying to exclude a series of ID's. I couldn't understand why everything worked fine and dandy with one record, but not with multiple. My Query $this->db->where_not_in('crm.user_id', $ignore); The problem is when I profile the the Query is wrong. With a string of ID's // $ignore = "12,13"; SELECT * FROM (`crm`) WHERE `crm`.`user_id` NOT IN ('16,13') AND `survey` = 1 With a string of Quotes ID's // $ignore = "'12','13'"; SELECT

Student absent for 5 consecutive days excluding Holidays

微笑、不失礼 提交于 2020-01-30 04:04:57
问题 I am using code igniter and attendance table as below: attendance ID timestamp student_id status 1 01-01-20 1 P 2 01-01-20 2 P 3 02-01-20 1 P 4 02-01-20 2 A 5 03-01-20 1 P 6 03-01-20 2 A 7 04-01-20 1 H 8 04-01-20 2 H 9 05-01-20 1 P 10 05-01-20 2 A My target is to get the student id who is absent for 3 consecutive days for the period of the last 1 month from today excluding the holidays in the middle like in the above table the student id 2 should be the one with 3 consecutive absence

Student absent for 5 consecutive days excluding Holidays

给你一囗甜甜゛ 提交于 2020-01-30 04:04:16
问题 I am using code igniter and attendance table as below: attendance ID timestamp student_id status 1 01-01-20 1 P 2 01-01-20 2 P 3 02-01-20 1 P 4 02-01-20 2 A 5 03-01-20 1 P 6 03-01-20 2 A 7 04-01-20 1 H 8 04-01-20 2 H 9 05-01-20 1 P 10 05-01-20 2 A My target is to get the student id who is absent for 3 consecutive days for the period of the last 1 month from today excluding the holidays in the middle like in the above table the student id 2 should be the one with 3 consecutive absence

Codeigniter - Unable to call system's lang() function

[亡魂溺海] 提交于 2020-01-29 17:56:32
问题 Trying to call lang() function that is part of codeigniter's system/helpers (language_helper.php), resulting in a Fatal error Fatal error: Call to undefined function lang() $def_actions['add'] = array('name' => lang('carbogrid_add'), 'alias' => 'add', 'url' => $this->add, 'icon' => 'ui-icon-circle-plus', 'toolbar' => TRUE, 'grid' => FALSE); 回答1: You have to load the helper before doing that: $this->load->helper('language'); $def_actions['add'] = array('name' => lang('carbogrid_add'), 'alias'

Codeigniter - Unable to call system's lang() function

大憨熊 提交于 2020-01-29 17:56:13
问题 Trying to call lang() function that is part of codeigniter's system/helpers (language_helper.php), resulting in a Fatal error Fatal error: Call to undefined function lang() $def_actions['add'] = array('name' => lang('carbogrid_add'), 'alias' => 'add', 'url' => $this->add, 'icon' => 'ui-icon-circle-plus', 'toolbar' => TRUE, 'grid' => FALSE); 回答1: You have to load the helper before doing that: $this->load->helper('language'); $def_actions['add'] = array('name' => lang('carbogrid_add'), 'alias'

Codeigniter Message: Undefined property: stdClass

心已入冬 提交于 2020-01-28 11:21:12
问题 I'm trying to query the db with the following query in the model: function showSpecific(){ $all = $this->session->all_userdata(); $name = $all['u_name']; $id = $this->db ->select('u_id') ->from('users') ->where('u_name', $name) ->get() ->row(); $id = $id->u_id; $data = $this->db->query("SELECT messages.m_id, messages.post_id, messages.m_betreff, messages.an_user, messages.von_user, messages.m_time, users.u_id, users.u_name, posts.p_titel, users.u_id, messages.m_content FROM messages INNER

Codeigniter $this->email->send() not working while mail() does

家住魔仙堡 提交于 2020-01-28 06:30:05
问题 I can't figure out why if I try to use the CI Email Class it doesn't send emails, while if I use the native PHP mail() Class works. Has to be noted that sometimes I get "email sent" while is not actually sent and sometimes I get the error "my server is not setup". I tried to figure out how to set it up but... nothing... Controller code follows: if($this->form_validation->run()){ //Set Language $this->lang->load('site', $this->session->userdata('lang')); //Random key $user_valid_key = md5

how to load images of css file in codeigniter [closed]

♀尐吖头ヾ 提交于 2020-01-26 04:19:06
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . i have problem to load images in coedigniter, with the help of base_url() , i succeed to load css but unfortunately images not. Actualy images are called

Can 2 .htaccess files block URL rewriting

我只是一个虾纸丫 提交于 2020-01-26 04:18:09
问题 I have a codeigniter project inside the b1 folder in my public_html folder: mydomain.com/b1/controller/function I want to change it to: mydomain.com/controller/function in the browser bar using a 301 redirect. My .htaccess file in my public_html has: RewriteEngine on RewriteRule ^b1/(.*)$ /$1 [R=301,L,NC] RewriteRule ^(.*)$ b1/$1 EXPLANATION: RewriteRule ^b1/(.*)$ /$1 [R=301,L,NC] # THIS IS TO REWRITE ALL REQUESTS FROM THE NAVBAR IN MY PROJECT WHICH HAVE THE FORM mydomain.com/b1/controller