codeigniter

My redirect function is not working in codeigniter?

回眸只為那壹抹淺笑 提交于 2019-12-25 03:12:42
问题 I have the following code: $this->video->videoupdate($userid, $title, $id); redirect("admin/videos", "refresh"); But the redirect is not working and I don't know why (I am using CodeIgniter) 回答1: Have you sent anything to the browser prior to calling redirect? From the user guide Note: In order for this function to work it must be used before anything is outputted to the browser since it utilizes server headers. 回答2: have you loaded the URL helper? $this->load->helper('url'); Load this in

Issue in accessing table contents using status parameter

半腔热情 提交于 2019-12-25 03:03:30
问题 I am trying to display jobs won by a certain provider. What I did was to create function get_approved_job_proposals in my model. Then, I created function manage_job_contracts in my controller, but I never got to successfully run it. Here's my code in model: public function get_approved_job_proposals($status) { $this->db->select('*')->from('job_proposal')->where('status', $status); $this->db->where("status" == "Awarded"); $query = $this->db->get(); return $query->result_array(); } and this is

Declare global array in codeigniter to access between different functions

纵饮孤独 提交于 2019-12-25 03:03:16
问题 I want to declare a global variable in my model and will use it accordingly. syntax below is just example how I want to use it, may not be proper syntax. But I want to know proper syntax for this to implement. global $stddata call to 1st function via ajax: add a array of data to this global variable. global $stddata = array(1=>"a",2=>"b"); after user triggers some event call to 2nd function via ajax: Access the array stored in global variable above. echo $stddata 回答1: Your question is similar

Can I do this with just SQL?

邮差的信 提交于 2019-12-25 03:00:15
问题 At the moment I have two tables, products and options . Products contains id title description Options contains id product_id sku title Sample data may be: Products id: 1 title: 'test' description: 'my description' Options id: 1 product_id: 1 sku: 1001 title: 'red' id: 2 product_id: 1 sku: 1002 title: 'blue' I need to display each item, with each different option. At the moment, I select the rows in products and iterate through them, and for each one select the appropriate rows from options .

form validation for different condition in code igniter

拈花ヽ惹草 提交于 2019-12-25 02:58:37
问题 So i have a form that used for two functions/conditions : Save(add) and Update Now i set a rule to my input text : $this->form_validation->set_rules('ID_user', 'User ID', 'required'); The logic is like this: if the user is in Save condition then my input text will be enable because they will tyoe their id, but if the user is in Update condition then my input text will be disable and the text will be the current user id because they cant change their user id. This is the Save(add) and update

Code igniter with data mapper giving in valid json

﹥>﹥吖頭↗ 提交于 2019-12-25 02:57:38
问题 I have this to select columns from a table and I want to pass this to Jquery ajax fn. I am using below code but getting invalid json My table has three column id, name and city but I am not selecting city This is my json reponse ["{id:1,name\":\"JOHN\",\"city\":\"null\"}" ,"{\"id\":2,\"name\":\"MICHEAL\,\"city\":\"null\"}"] 回答1: Sadly the current stable (1.8.1) WanWizard datamapper DMZ_Json class double encode fields when you call all_to_json() . This issue seem to be fixed in the develop

CodeIgniter How to use onsubmit event in form_open()

岁酱吖の 提交于 2019-12-25 02:57:08
问题 In HTML, I can call a javascript function like below <form type="post" onsubmit ="return test()" > </form> How do I call the same javascript function in form_open(); When form gets posted, I want function test to be called. How do I do above in CodeIgniter? Update x.html is my HTML page <form> </form> <?php $data = array('submit'=>"test()"); echo form_open(x,$data); echo form_close(); ?> 回答1: In your template file x.html use <?php $data = array('onsubmit' => "test()"); ?> <?php echo form_open

Check if user is not active, not to log in

ぃ、小莉子 提交于 2019-12-25 02:55:40
问题 I want to add condition for my login form - if a user is not already active, not to log in. I'm using CodeIgniter. That's my controller: public function login () { $this->load->model('user_model'); $user=$this->user_model->login(); $this->form_validation->set_rules('username', 'Username', 'trim|required|callback_login_check'); $this->form_validation->set_rules('password', 'Password', 'trim|required'); if ($this->form_validation->run()==FALSE) { $this->index(); } else { if(count($user) > 0 ) {

PhpExcel Save file to a folder

可紊 提交于 2019-12-25 02:45:01
问题 I want to save the generated file to a folder located in the server, I tried the following code : //save it to Excel5 format (excel 2003 .XLS file), change this to 'Excel2007' (and adjust the filename extension, also the header mime type) //if you want to save it as .XLSX Excel 2007 format $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); //force user to download the Excel file without writing it to server's HD $objWriter->save('‪C:\xampp\htdocs\timesheet\files\trials.xls

Stripe Webhooks Not Working

喜欢而已 提交于 2019-12-25 02:43:12
问题 I have implemented a stripe test gateway in an application... The integration page is using the jQuery mode for sending data. Its built in the MVC structure using Codeigniter. Now, here my controller: <?php class stripe_connect extends CI_Controller{ public function __construct() { parent::__construct(); @session_start(); } function index() { $this->load->view('stripe_same_site_connect'); } } ?> And here's my view file, <!DOCTYPE html> <html> <head> <script type="text/javascript" src="<?php