codeigniter

CodeIgniter - implode/query binding causing unwanted string

允我心安 提交于 2019-12-24 07:09:31
问题 I have the following query attempting an update in CodeIgniter: $sql = "UPDATE fanout.manual_data SET call_leader_id = ? WHERE id IN (?)"; $q = $this->db->query($sql, array($leaderID, implode(", ", $empIDs))); The implode is creating a string of all the IDs in my array. However, that is resulting in the query looking like: UPDATE fanout.manual_data SET call_leader_id = '55993' WHERE id IN ('57232, 0097726, 0076034'); When what I need is: UPDATE fanout.manual_data SET call_leader_id = '55993'

CodeIgniter can't call function from model in controller

心已入冬 提交于 2019-12-24 07:02:42
问题 I am fairly new to Codeigniter and am trying to call in a function from my model but I cannot get it to work. Can anyone see what I am doing wrong here? Controller (farm.php): <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Farm extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('harvest_first'); } function harvest() { echo $this->harvest_first->harvest(); } } Model (harvest_first.php): <?php if ( ! defined('BASEPATH')) exit(

Inserting data in to database using jquery/ajax,i am not getting ant error but values not inserting in to the database

前提是你 提交于 2019-12-24 06:48:51
问题 Inserting data in to database using jquery/ajax,i am not getting ant error but values not inserting in to the database using codeigniter,any mistake i done means please suggest me <script type="text/javascript"> $(document).ready(function () { $("#personal-info").click(function () { e.preventDefault(); var message = $("#message").val(); // var password= $("#password").val(); $.ajax({ type: "POST", url: "<?php echo base_url(); ?>index.php/Profile_cntrl/buyer_communication", data: {message:

Codeigniter 3 blog application: how can I avoid redundancy of static data?

孤人 提交于 2019-12-24 06:45:34
问题 I am working on a blog application in Codeigniter 3.1.8. I have a model with "static" data like the website's title, the contact email address, etc: class Static_model extends CI_Model { public function get_static_data() { $data['site_title'] = "My Blog"; $data['tagline'] = "A simple blog application made with Codeigniter 3"; $data['company_name'] = "My Company"; $data['company_email'] = "company@domain.com"; return $data; } } In my Posts Controller, which handles both the posts page and the

CodeIgniter 3.0 insert_batch works localhost but not on server

妖精的绣舞 提交于 2019-12-24 06:40:52
问题 I have a customer model with the following function: public function add($data) { $this->db->insert_batch('customers', $data); } Using this function in localhost on a 5.6 php environment works without any problem. On server with 7.0 php environment I receive the error: <p>Severity: Warning</p> <p>Message: array_keys() expects parameter 1 to be array, boolean given</p> <p>Filename: database/DB_query_builder.php</p> <p>Line Number: 1549</p> <h1>A Database Error Occurred</h1> <p>Error Number:

Autoload in the Post

廉价感情. 提交于 2019-12-24 06:34:18
问题 I want to autoload like this web: https://www.thejakartapost.com/news/2019/04/09/woman-decapitated-in-traffic-accident-in-depok.html But after I implemented it, the results looped the same data like this: https://staging.casaindonesia.com/article/read/12/2016/79/Lantai-Motif-Kayu-dengan-Low-Maintance Is there something wrong with my program? ( Sorry, my english isn't good enough) Controller.php public function more(){ $data['asset'] = $this->asset; $data['gallery'] = $this->gallery; $page

Codeigniter dynamic navigation

浪尽此生 提交于 2019-12-24 06:01:46
问题 I am a newbie with codeigniter. I am trying to write an application using mysql database. In my site I want to use menu as : +Homepage +About +Services +Education services +neurofeedback +biofeedback I need some information to understand. I use pages controller as main pages controller: <?php class Pages extends CI_Controller { public function view($page = 'home') {$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer',

Codeigniter File Upload Custom Error Messages

天大地大妈咪最大 提交于 2019-12-24 05:59:35
问题 I'm new to Codeigniter's Upload library, but I am familiar with the standard form library. My aim is to instead of use the standard upload library error messages (example: The file you are attempting to upload is larger than the permitted size.) use my own error messages. In the standard form validation I could use the following code: $this->form_validation->set_message('required', 'The %s is a required field. Please ensure this field contains the relevant data before continuing.'); However

How do obfuscate JSON response when dealing with a DB query?

无人久伴 提交于 2019-12-24 05:58:00
问题 [ { "businesscards_id":"12", "X_SIZE":"1.75x3", "X_PAPER":"14ptGlossCoatedCoverwithUV(C2S)", "X_COLOR":"1002", "X_QTY":"250", "O_RC":"NO", "F_PRICE":"12490", "UPS_GROUND":"12000", "UPS_TWODAY":"24000", "UPS_OVERNIGHT":"36000" } ] This JSON encode response is seen in console of Chrome. This array is being returned from a DB query. It is showing my table column names. For security reasons I do not want to show my table column names. How can this JSON object be obfuscated or hashed and/or

How to search multiple columns with priority in MySQL?

纵然是瞬间 提交于 2019-12-24 05:56:13
问题 I currently have a PHP function (codeigniter) which takes a query string (from post), and returns relevant MySQL rows, like this: $term = $this->input->post("query"); $rows = $this->db->query("SELECT id, title as 'desc' , abbreviation , etc FROM shows WHERE abbreviation LIKE '%".$term."%' OR title LIKE '%".$term."%' OR etc LIKE '%".$term."%' LIMIT 10; ")->result_array(); this works, but lets say my table is like this : id title abbreviation -- ---------------------- ------------ 1 The Big