codeigniter

Zero (0 ) Database Result in Codeigniter

强颜欢笑 提交于 2019-12-25 08:46:23
问题 In view->new_entry.php <?=form_open(base_url().'home/insert_entry/')?> <p>Title: <?=form_input('title')?></p> <p>Content: <?=form_textarea('content')?></p> <p>Tags: <?=form_input('tags')?> (comma separated)</p> <?=form_submit('submit', 'Insert')?> In home/insert_entry: public function insert_entry(){ login_site(); $entry = array( 'permalink' => permalink($this->input->post('title')), 'author' => $this->session->userdata('username'), 'title' => $this->input->post('title'), 'content' => $this-

using jquery mobile and codeigniter framework php

狂风中的少年 提交于 2019-12-25 08:27:26
问题 I'm creating jquery mobile site using codeigniter framework.If I start my project without using jquery mobile in the head everything work but if I insert jquery mobile in the head of my page and try to start my project I receive a gray page with write on undefined . I want explicity say that I'm not using any scripts in my page only I call in the head : <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min

Codeigniter: Unable to echo data

随声附和 提交于 2019-12-25 08:25:21
问题 Ok folks, I have an odd issue with a function of mine. public function getOutages($Site) { // pull a json data dump of all outages If(!$Site){ echo '[{}]'; }else{ $this->load->database('default', TRUE); $this->db->where('Clear', '0'); $this->db->where('FracID', $Site); $query = $this->db->get('vw_Outages'); echo json_encode($query->result_array()); } } This when accesed directly will not echo anything. By enabling the profiler though it functions fine and outputs the data. public function

Unable to connect to ssl://smtp.googlemail.com:25 while implementing email CodeIgniter lib

不打扰是莪最后的温柔 提交于 2019-12-25 08:22:59
问题 My log file shows this error: ERROR - 2016-12-03 03:22:10 --> Severity: Warning --> fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol E:\xampp\htdocs\verime_v11\system\libraries\Email.php 2014 ERROR - 2016-12-03 03:22:10 --> Severity: Warning --> fsockopen(): Failed to enable crypto E:\xampp\htdocs\verime_v11\system\libraries\Email.php 2014 ERROR - 2016-12-03 03:22:10 --> Severity: Warning --> fsockopen()

Restarting active query in codeigniter

◇◆丶佛笑我妖孽 提交于 2019-12-25 08:22:47
问题 For example, if ı have lines like this: $this->db->where("blabla",$blala); And following this line, I decided not to use this where clause (in runtime) and start doing a query from scratch. How can I disregard this where clause in active record? 回答1: Maybe you can try $this->db->_reset_select(); 回答2: You can't. This is a logical problem which you have to make sense of. Instead of saying $this->db->where('blabla', $blala); if($dont_use_where_clause) { //something to ignore the where cause

store user_id in the backend automatically depending on user type in codeigniter

試著忘記壹切 提交于 2019-12-25 08:20:17
问题 I have two tables in my database..one is candidates_details and another one is users..in the users table i have two types of users one is vendor and another one is user..they both have same user_id column...and i have that user_id column in my candidates_details table.. So what i want to do is when vendor post candidate_details by using form ..i want to store that user_id (where user_type_id=1) in candidates_details table automatically.. Can anyone help me..Thanks in advance.. 回答1: Let me

Codeigniter : Database to multidimensional array

最后都变了- 提交于 2019-12-25 08:14:41
问题 I am fetching data from a database like this in a Library Management System Details about user from specific id Get all the books assigned to the user from books_assigned table Get details of the assigned books from books table This is what i am doing public function userhistory($id){ $query= $this->db->get_where('user',array( 'id' => $id, )); $result['user']= $query->result(); $query_books = $this->db->get_where('book_assign', array( 'user_id' =>$result['user'][0]->id, )); foreach ($query

How to check email address or username is valid or exist through same post?

假装没事ソ 提交于 2019-12-25 08:00:09
问题 How to check email address or username is valid or exist through same post? HTML <form action="/index" method="post"> <input name="post" type="text" value="Username or Email" /> <input name="submit" name="send" value="Submit" /> </form> PHP public function index($post) { $results = $this->db->where('username', $post) ->where('email', $post) ->get('users'); if($results->num_rows() > 0) { //The user has an email or username echo "valid"; } else { echo "Invalid"; } } 回答1: Change the second -

Php - Codeigniter url spaces

二次信任 提交于 2019-12-25 07:59:34
问题 I'm trying to do is when i clicked my specific product, instead of the id of my product would appear in my url, i want to put the name of the product . what i did today is base_url/controller/method/id i want to do is base_url/controller/method/product-name or base_url/controller/method/product_name but in my code what happened is in my product name all the spaces is occupied by %20 what should i do to replace the %20 by either underscore or dash or whatever safe way to call the product name

Codeigniter Query Builder having clause with IN statement

倖福魔咒の 提交于 2019-12-25 07:58:38
问题 I am using CodeIgniter query builder. I want to add the having clause in there. My code looks as follows: (i omitted the other parts of the query): $this->db->having($filterarray); And i build the filterarray beforehand like this: $filterarray = array(); if (!empty($filters['interests'])) { $interestids = $this->interests_model->getAllIdsByDescription($filters['interests']); $filterarray['interests IN'] = $interestids; } My function getAllIdsByDescription looks like this: function