codeigniter

codeigniter $this->db->where(); custom string problem

两盒软妹~` 提交于 2019-12-23 08:58:16
问题 Im trying to select some values using a custom string. below is my code $this->db->from('posted'); $st="infor='rent' AND (typeq='in' OR typeq='out')"; $this->db->where($st); $q = $this->db->get(); A Database Error Occurred Error Number: 1054 Unknown column ‘infor=‘rent’’ in ‘where clause’ SELECT * FROM (`posted_ads`) WHERE `infor=‘rent’` AND (typeq=‘in’ OR typeq=‘out’) Filename: C:\wamp\www\parklot\system\database\DB_driver.php Line Number: 330 i think the problem is coz of WHERE `infor='rent

Codeigniter 3 autoload controller

穿精又带淫゛_ 提交于 2019-12-23 08:54:04
问题 I'm using REST Server in codeigniter, and the way to use is that then in my app in all my controllers I must write this line on start: require APPPATH . '/libraries/REST_Controller.php'; Does anyone know how to autoload this REST_Controller and to avoid this line in all my controllers? I don't want to use require. Thank in advance 回答1: You can achieve this through Codeigniter 's autoload configuration. Edit your project's autoload.php which is located in directory YourProject/application

Codeigniter's insert_batch() with thousands of inserts has missing records

北战南征 提交于 2019-12-23 08:49:35
问题 I’m using insert_batch() to mass insert 10000+ rows into a table in a database. I’m making some tests and I have noticed that sometimes all the 10.000+ rows are getting inserted correctly but in some occasions I miss 100+ rows in my table’s total count. The field data in the records I have are ok as I'm using the same data for each of my tests and most of the times I have no problem. For example I tried 20 times to insert the same data into my database and at 19 times all rows will be

What design pattern is Codeigniter using?

喜你入骨 提交于 2019-12-23 08:45:06
问题 Fairly straightforward question: I know that Codeigniter is a MVC framework - however what design pattern is Codeigniter using? From first look it seems like Facade, but I could be wrong. Edit: Perhaps I should describe Codeigniter for those who don't use it. In Codeigniter you have a concept of a Controller and a Model, which each has their own separate folder. In each of the folders you create a file: cart.php: <?php class Cart { //... } ?> Then you can also have a model: <?php class User {

codeigniter : getting data between two dates in mysql using php

淺唱寂寞╮ 提交于 2019-12-23 08:37:18
问题 I want to retrieve data between two dates in mysql. from date : 01/04/2015 to date : 01/05/2015 but i cant get date these in single variable; how i am get as below mentioned: $fdate=01; $fmonth=04; $tdate=01; $tmonth=05; $year=2015; my code in model : function date_range($fdate,$fmonth,$tdate,$tmonth,$year) { $this->db->select('*'); $this->db->where('DAY(order_date) >=',$fdate); $this->db->where('MONTH(order_date) >=',$fmonth); $this->db->where('YEAR(order_date) >=',$year); $this->db->where(

Failed to send AUTH LOGIN command in codeigniter

我与影子孤独终老i 提交于 2019-12-23 08:16:06
问题 im getting bunch of errors everytime i try to send email: hello: The following SMTP error was encountered: Failed to send AUTH LOGIN command. Error: from: The following SMTP error was encountered: to: The following SMTP error was encountered: data: The following SMTP error was encountered: The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. User-Agent: CodeIgniter Date: Sun, 1 Jul 2012 20:47:47

mail vs sendmail

百般思念 提交于 2019-12-23 08:02:22
问题 I am using the Email class in Codeigniter, and in the manual I see that there are 3 protocols that can be used: mail, sendmail and smtp. What is the dfiference between mail and sendmail? Is it true that using mail protocol will have a higher chance of having the domain marked as spam? 回答1: If you're using *nix, chances are mail() and sendmail() are identical. mail() will still use sendmail, but it passes any arguments you have defined in your php.ini. The bigger difference is between SMTP and

Codeigniter URI Class how can i use – hyphen instead _ underscore?

六眼飞鱼酱① 提交于 2019-12-23 07:47:43
问题 i tried create some controllers, models and views with - hyphen, but i get php error always so i am using underscore right now. so my url is: http://localhost:8888/ci/index.php/get_artist_discography/artist_name i would like be like that: http://localhost:8888/ci/index.php/get-artist-discography/artist-name its possible have urls with - hyphen in codeigniter? my code: /controllers: <?php include (APPPATH.'/libraries/REST_Controller.php'); class get_artist_discography extends REST_Controller {

CodeIgniter/jQuery - Ajax call returns full html page instead of my echo

爱⌒轻易说出口 提交于 2019-12-23 07:46:47
问题 In my view I have an ajax call: $(".previous").click(function() { $.ajax({ type: "POST", url: "planner/get_cal", data: {current_month: current_month}, success: function(msg){ alert(msg); } }); the get_cal function in my Planner controller: function get_cal() { echo "dinosaurs"; } However, instead of returning "dinosaurs", it returns a full HTML page. I can't figure out why. Thoughts? Thanks a lot. 回答1: I solved this by using a leading slash as suggested in the comments to my question. $.ajax(

Codeigniter deleting data with joins tables

我是研究僧i 提交于 2019-12-23 07:46:32
问题 Logically in SQL we can delete data from tables with JOINS e.g. DELETE clb_subscriber_group_mapping .* FROM clb_subscriber_group_mapping INNER JOIN clb_driver_group ON (clb_driver_group.id = clb_subscriber_group_mapping.driver_group_id) INNER JOIN clb_company ON (clb_company.id = clb_driver_group.company_id) WHERE clb_company.id = 256 AND clb_subscriber_group_mapping.subscriber_id = 1784; What will be the CodeIgniter equivalent of above query? Does CodeIgniter support Delete query with joins?