codeigniter

How to pass parameter from cron command to codeigniter function?

无人久伴 提交于 2019-12-23 02:05:34
问题 I am working with code-igniter and running a function from cron job. class event extends CI_Controller { public function newEvent() { //some process here using the parameter } } cron command: * */2 * * * /usr/bin/php /var/www/project/index.php 'event/newEvent/parameter' I want to pass the parameter like written in cron command and do some process with that parameter in newEvent function. What extra code I should write in my function to receive the parameter from cron command. Thanks 回答1: CI

When I save span with style to MySQL, style is deleted

喜欢而已 提交于 2019-12-23 01:42:22
问题 I am using TinyMCE for my PHP/CodeIgniter CMS back-end input. However when I use a text color, some of codes are not saved and does not show the correct color. How can I solve this problem? Thanks in advance. <span style="color: #ff00ff;">Some text</span> becomes <span #ff00ff;">Some text</span> in database Some codes are here. In my controller. function _fields() { $data = array( .... 'content' => $_POST['content'], .... ); return $data; } function create() { // We need TinyMCE, so load it

Unlink after force download not working Codeigniter

送分小仙女□ 提交于 2019-12-23 01:40:05
问题 i was unable to remove my file after force download.below is the code public function download($id) { $this->load->helper('download'); $filepath = "url/" . $id; force_download("file-name", $filepath); ignore_user_abort(true); unlink($filepath); } Kindly update me on this regard. 回答1: I have came across same situation. So i just want to share the following information if that helps people in need. Actually force_download("file-name", $filepath); Nothing you have written after this piece of

Custom URL in Codeigniter using htaccess

点点圈 提交于 2019-12-23 01:35:33
问题 I am developing a site on Codeigniter 2.0.2 . Its a site where companies/users can signup and create their own profile page, have their own custom url(like http://facebook.com/demouser), have their own feedback system, display their services. This said, I have been successful in display the profile page in the following format http://mainwebsite.com/company/profile/samplecompany This displays the home page for the company samplecompany , where company is the controller and profile is the

Custom URL in Codeigniter using htaccess

ぐ巨炮叔叔 提交于 2019-12-23 01:34:56
问题 I am developing a site on Codeigniter 2.0.2 . Its a site where companies/users can signup and create their own profile page, have their own custom url(like http://facebook.com/demouser), have their own feedback system, display their services. This said, I have been successful in display the profile page in the following format http://mainwebsite.com/company/profile/samplecompany This displays the home page for the company samplecompany , where company is the controller and profile is the

codeigniter: Pagination logic to show 2 lists per page

你离开我真会死。 提交于 2019-12-23 01:29:19
问题 I am having a pagination page in my controller, i am kind of puzzled in listing 2 data per page on my view. The controller code which i am using is as follows: public function newsletter() { $this->load->library('pagination'); $config = array(); $config["base_url"] = base_url() . "index.php/welcome/newsletter"; $this->load->model('newsletter_model'); $total_row = $this->newsletter_model->record_count(); $config["total_rows"] = $total_row; $config["per_page"] = 2; // per page 2 records $config

Email in loop sends the same file using Email class in Codeigniter

妖精的绣舞 提交于 2019-12-23 01:28:09
问题 Hey I'm using Codeigniter's Email helpers, and expiriencing a wierd issue. I have the following code : $path = mpdf_create_billing($html); $this->load->library('email'); $this->email->set_newline("\r\n"); $this->email->from('no-reply@foo.com'); $this->email->to("foo@gmail.com"); $this->email->subject('Invoice for '.date('d/m/y')); $this->email->message($message); $this->email->attach($path); if($this->email->send()) echo "Email Sent Successfully to $email with the file $path<br>"; else echo

CodeIgniter - query binding “IN” parameter

China☆狼群 提交于 2019-12-23 01:19:07
问题 I have a following query in my CodeIgniter, which I'm trying to bind via parameter. $q = "SELECT * FROM my_table WHERE id IN (?)" $ids = "1,2,3,4"; $this->db->query($q, array($ids)); Above is not working, because the query binding treats $ids as string. How can I parameterize my query, but still be able to do "IN" operation? EDIT sorry, I have to use "raw SQL query". Above query is just a part of a much larger + complex query, which I can't use ActiveRecord for. Also I'm using Postgres. 回答1:

How to do ItemLookup with Zend Service Amazon?

醉酒当歌 提交于 2019-12-23 01:18:27
问题 I would appreciate if anyone could guide me on the correct way on doing an ItemLookup by ISBN using the Zend Amazon Service module (with Zend 2.0). Here is my attempt: $query = new ZendService\Amazon\Query($appId, 'UK', $secretKey); $query->Category('Books')->IdType('ISBN')->ItemID('978-0321784070')->AssociateTag($tag); $result = $query->ItemLookup(); But I get the following errors: Missing argument 1 for ZendService\Amazon\Amazon::itemLookup(), called in D:\wamp\www\site\controllers\dev.php

codeigniter distinct mysql query

我是研究僧i 提交于 2019-12-23 01:13:22
问题 whenever I use get_where in the model it gives me all database entries including duplications and when I use get only it only gives me the first entry. But I want all distinct entries. Can anyone help me please. Thanks a lot! Controler = site.php: public function western_australia(){ $this->load->model("continents_get"); $data["results"] = $this->continents_get ->getMaincategories("western_australia"); $this->load->view("content_western_australia", $data); } model = continents_get.php