Search Results

Search found 1343 results on 54 pages for 'burning the codeigniter'.

Page 16/54 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Codeigniter: Library function--I'm stuck

    - by Kevin Brown
    I have a library function that sets up my forms, and submits data. They're long, and they work, so I'll spare you reading my code. :) I simply need a way for my functions to determine how to handle the data. Until now, the function did one thing: Submit a report for the current user. NOW, the client has requested that an administrator also be able to complete a form--this means that the form would be filled out, and it would CREATE a user at the same time, whereas the current function EDITS and is accessed by an EXISTING user. Do I need a separate function to do essentially the same thing? How do I make one function perform two tasks? One to update a user, and if there is no user, create one. Current controller: function survey() { $id = $this->session->userdata('id'); $data['member'] = $this->home_model->getUser($id); //Convert the db Object to a row array $data['manager'] = $data['member']->row(); $manager_id = $data['manager']->manager_id; $data['manager'] = $this->home_model->getUser($manager_id); $data['manager'] = $data['manager']->row(); $data['header'] = "Home"; $this->survey_form_processing->survey_form($this->_container,$data, $method); } Current Library: function survey_form($container) { //Lots of validation stuff $this->CI->validation->set_rules($rules); if ( $this->CI->validation->run() === FALSE ) { // Output any errors $this->CI->validation->output_errors(); } else { // Submit form $this->_submit(); } $this->CI->load->view($container,$data); The submit function is huge too. Basically says, "Update table with data where user_id=current user" I hope this wasn't too confusing. I'll create two functions if need be, but I'd like to keep redundancy down! }

    Read the article

  • site search with codeigniter?

    - by sonill
    hi, i need to make a simple site search with a pagination in it, can anyone tell me how to do it with out affecting the url structure. currently i m using default ci url structrue and i have removed index.php from it. any sugestion guys?....

    Read the article

  • Access Codeigniter database functions from file

    - by Manny Calavera
    Hello. I am using a SWFupload script and I can't make a request from flash with mod_rewrite, I don't know why... I just need to point the Flash request to that file directly. This file runs an upload script that works ok but now I need to save some info to the database and I would like to know what should I write to have access from that file that is not called from the controller and does not extend the model in order to run a mysql query. Thanks.

    Read the article

  • Passing jquery JSON from Codeigniter controller to view

    - by dede
    I've been struggling to make it work, but cannot pass the inserted data from the controler to the view in CI using JSON. The input value from the form is successfully inserted into the database, but cannot make it appear in the view. This is my view file ajax_view.php: <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.4.2.min.js"></script> $(document).ready(function(){ $("#submit").click(function(){ var inp = $('#inp').val(); $.post("ajax/ajax_input", { 'send' : inp }, function(data){ alert(data.input_text); }, "json"); }); }); </script> </head> <body> <form id="form1" method="post" action=""> <label for="inp">Text</label> <input type="text" name="inp" id="inp" /> <label for="submit"></label> <input type="submit" name="submit" id="submit" value="Submit" /> And this is the ajax_input method of the ajax.php controller: <?php // Initializing controller ..... // ............................. //ajax method function ajax_input(){ $var_1 = trim($this->input->post('send')); $array = array('input_text' => $var_1); echo json_encode($array); $this->db->insert('ajax',$array); } Trying to debug it with Firebug, it gives me that data.input_text is empty. What am I doing wrong? EDIT: I'm using XAMPP on Win, so is it posible that json configuration is the problem?

    Read the article

  • Codeigniter database update

    - by Carry All
    The table is like this and I want to update DecryptionDate by specify ArchiveID and RecipientID this is my code $this->load->database(); $date = date("Y-m-d H:i:s"); $data = array('DecryptionDate' => $date); $array = array('ArchiveID'=>$archiveID.'','RecipientID'=>$userID.''); $this->db->where($array); $this->db->update('log', $data); if ($this->db->affected_rows() > 0) { echo "SUCCESS"; } else { echo "FAIL"; } my problem is I can update the data only when $archiveID is 911 and $userID is test01 but the program fail to update when $archiveID is 911 and $userID is test02

    Read the article

  • CodeIgniter: Weird echo of $config coming back when I load Email Library

    - by k00k
    Version info: CI version 1.7.2 - PHP 5.3.1 - Apache2 - Mac OSX 10.6.3 For some reason, when I load CI's email library, either in my controller, or in autoload.php, it automatically and immediately echoes the config info like so: $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE If I autoload the email library in autoload.php, it is echoed before anything else in my source/page. If I call it explicitly within my controller, it's echoed at that exact point. I'm stumped, never seen that before. Any ideas on how to surpress/eliminate?

    Read the article

  • PHP/codeigniter - use of exit()

    - by Patrick
    I have a few pages that require login, so all controllers that link to these pages start with $this->checkSession(); //...rest of the code CheckSession should verify the session is still live, otherwise display a message and stop the execution of the rest of the code in the controller: function checkSession() { if (!$this->session->userdata('is_logged_in')) { //the session has expired! $data['main'] = 'confirmation_message'; $data['title'] = "Session expired"; $this->load->vars($data); $this->load->view('template'); exit(); } } . I was expecting these instructions to happen in sequence, but I only get a blank page. How can I make sure exit() gets executed only after all views are loaded?

    Read the article

  • Write permissions with Codeigniter + Simplepie

    - by Malachi
    I am trying to create a simple RSS parser using the two frameworks. However I am getting PHPerrors when trying to write to my cache directory: set_cache_location(APPPATH.'cache/rss'); I am running windows 7 with XAMPP using the latest version of Simplepie from github error: A PHP Error was encountered Severity: User Warning Message: C:\xampp\htdocs\geekurls/system/application/cache/rss is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable. Filename: libraries/simplepie.php Line Number: 1732

    Read the article

  • Codeigniter Write_file Question

    - by Brad
    I am writing to a txt file to back up certain posts. Here is my simple code $this->path = APPPATH . "post_backups/"; $string = $this->input->post('post'); $post_title = $this->input->post('post_title'); $this->file = $this->path . $post_title."txt"; write_file($this->file, $string); $this->index(); Every thing works fine except this $this->file = $this->path . $post_title."txt"; I am trying to name my file with the title of the post IE: title.txt. What I am getting it s this "titletxt". How should the $post_title . "txt" be written to provide txt as an extension? Thanks

    Read the article

  • Displaying data from mutliple arrays with codeigniter

    - by Craig Ward
    I am trying to display results from a database where the results are contained in three tables. How do I echo out the results? $p- works, but $img- or $branch- doesn't. What am I doing wrong? Example code is below Sample controller: $p_id = $this-uri-segment(3); $this-load-model('One_model'); $data['prop'] = $this-One_model-get_details($p_id); $data['img'] = $this-One-get_images($p_id); $this-load-model('Two_model'); $data['branch'] = $this-Two_model-get_details($p_id); $this-load-view('a_test_view', $data); A Sample View <?php foreach ($property as $p):?> <p><?php echo $p->SUMMARY; ?></p> <p>We have <?php echo "$img->num_photos"; ?> photos</p> <p>Branch is <?php echo $branch->name; ?>. Telephone <?php echo $branch->tel; ?></p> <ul> <li><?php echo $p->FEATURE1; ?></li> <li><?php echo $p->FEATURE2; ?></li> <li><?php echo $p->FEATURE3; ?></li> <li><?php echo $p->FEATURE4; ?></li> <li><?php echo $p->FEATURE5; ?></li> <li><?php echo $p->FEATURE6; ?></li> <li><?php echo $p->FEATURE7; ?></li> <li><?php echo $p->FEATURE8; ?></li> <li><?php echo $p->FEATURE9; ?></li> <li><?php echo $p->FEATURE10; ?></li> </ul> <?php endforeach; ?>

    Read the article

  • Codeigniter Template library, add_js() method

    - by Karl
    using This Template Library when i try and use the add_js() function it errors out. I add the regions $_scripts to the template header file but when i load the page it says undefined variable _scripts. any thoughts? changed <?= $_scripts ?> to <?= (isset($_scripts)) ? $_scripts : “”; ?> and obviously i lose the error but the js file still isnt loading. I did an echo at each step though the add_js() method and the output is correct. I also did an output of $this-js and they both had the corret output. So it gets through the get_js method fine and sets the class variable fine but i dont get anything added to the actual page.

    Read the article

  • Codeigniter: simple form function

    - by Kevin Brown
    I'm stuck writing a simple form...I feel dumb. Here's my controller: function welcome_message(){ //Update welcome message $id = $this->session->userdata('id'); $profile['welcome_message'] = $this->input->post('welcome_message'); $this->db->update('be_user_profiles',$profile, array('user_id' => $id)); } And the html: <?php print form_open('home/welcome_message')?> <input type="checkbox" value="0" checked="false">Don't show me this again</input> <p> <input class="button submit" type="submit" class="close-box" value="Close" /> </p> <?php print form_close()?> Edit I simply need it to submit to a private function and return to the home page (page submitted from).

    Read the article

  • CodeIgniter Validation in Library does not accept callback.

    - by Lukas Oppermann
    Hey guys, my problem is the following: I am writing a login library. This library has a function _validation() and this uses the validation library to validate the data. With using normal validation methods it works just fine, but using a callback function just does not work. It is not called. I call it like this. $this->CI->form_validation->set_rules('user', 'Username', 'required|callback__check_user'); The functions name is _check_user and it uses the username _check_user($user). The function itself works fine and I can also call it in the class ($this-_check_user('username')) with a working result. I am guessing, there might be a problem because I am not workin in a controller so I have a CI instance $this-CI instead of just the original instance $this- Does anyone have a clue how to fix this? Thanks in advance.

    Read the article

  • Validating forms with regex in codeigniter

    - by Alex
    How can I validate a form using regex in codeiginiter. I'd like to check the input against: ^([0-1][0-9]|[2][0-3]):([0-5][0-9])$ I'm assuming the best way is in some sort of callback. I tried a bunch of ideas on the web but I can't seem to get any working.

    Read the article

  • CodeIgniter: problem using foreach in view

    - by krike
    I have a model and controller who gets some data from my database and returns the following array Array ( [2010] => Array ( [year] => 2010 [months] => Array ( [0] => stdClass Object ( [sales] => 2 [month] => Apr ) [1] => stdClass Object ( [sales] => 1 [month] => Nov ) ) ) [2011] => Array ( [year] => 2011 [months] => Array ( [0] => stdClass Object ( [sales] => 1 [month] => Nov ) ) ) ) It shows exactly what it should show but the key's have different names so I have no idea on how to loop through the years using foreach in my view. Arrays is something I'm not that good at yet :( this is the controller if you need to know: function analytics() { $this->load->model('admin_model'); $analytics = $this->admin_model->Analytics(); foreach ($analytics as $a): $data[$a->year]['year'] = $a->year; $data[$a->year]['months'] = $this->admin_model->AnalyticsMonth($a->year); endforeach; echo"<pre style='text-align:left;'>"; print_r($data); echo"</pre>"; $data['main_content'] = 'analytics'; $this->load->view('template_admin', $data); }//end of function categories()

    Read the article

  • Order by Domain Extension Name using CodeIgniter Active Record Class

    - by allan
    $extension = “SUBSTRING_INDEX(domain_name, ‘.’, -1)”; $this->db->order_by($extension, “asc”); It says: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘asc LIMIT 50’ at line 44 But its working when I didn’t used the $this-db-order_by Active Record Class such as this one: $this-db-query(“SELECT * FROM domain ORDER BY SUBSTRING_INDEX(domain_name, ‘.’, -1)”); Anyone please help me. Thanks.

    Read the article

  • form_dropdown in codeigniter

    - by Patrick
    I'm getting a strange behaviour from form_dropdown - basically, when I reload the page after validation, the values are screwed up. this bit generates 3 drop downs with days, months and years: $days = array(0 => 'Day...'); for ($i = 1; $i <= 31; $i++) { $days[] = $i; } $months = array(0 => 'Month...', ); for ($i = 1; $i <= 12; $i++) { $months[] = $i; } $years = array(0 => 'Year...'); for ($i = 2010; $i <= 2012; $i++) { $years[$i] = $i; echo "<pre>"; print_r($years); echo "</pre>";//remove this } $selected_day = (isset($selected_day)) ? $selected_day : 0; $selected_month = (isset($selected_month)) ? $selected_month : 0; $selected_year = (isset($selected_year)) ? $selected_year : 0; echo "<p>"; echo form_label('Select date:', 'day', array('class' => 'left')); echo form_dropdown('day', $days, $selected_day, 'class="combosmall"'); echo form_dropdown('month', $months, $selected_month, 'class="combosmall"'); echo form_dropdown('year', $years, $selected_year, 'class="combosmall"'); echo "</p>"; ...and generates this: <p><label for="day" class="left">Select date:</label><select name="day" class="combosmall"> <option value="0" selected="selected">Day...</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select><select name="month" class="combosmall"> <option value="0" selected="selected">Month...</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select><select name="year" class="combosmall"> <option value="0" selected="selected">Year...</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> </select></p> however, when the form is reloaded after validation, the same code above generates this: <!-- days and months... --> <select name="year" class="combosmall"> <option value="0" selected="selected">Year...</option> <option value="1">2010</option> <option value="2">2011</option> <option value="3">2012</option> </select> So basically the value start from 1 instead of 2010. The same happens to days and months but obviously it doesn't make any difference in this particular case as the values would start from 1 anyway. How can I fix this - and why does it happen? edit: validation rules are: $this->load->library('form_validation'); //...rules for other fields.. $this->form_validation->set_rules('day', 'day', 'required|xss_clean'); $this->form_validation->set_rules('month', 'month', 'required|xss_clean'); $this->form_validation->set_rules('year', 'year', 'required|xss_clean'); $this->form_validation->set_error_delimiters('<p class="error">', '</p>'); //define other errors if($this->input->post('day') == 0 || $this->input->post('month') == 0 || $this->input->post('year') == 0) { $data['error'] = "Please check the date of your event."; }

    Read the article

  • Codeigniter + ajax(jQuery) session problem

    - by faya
    Hello, I have a problem in server side retrieving session with using ajax post request. Here is my sample code: JavaScript: $(function() { $('.jid_hidden_data').submit(function() { var serialized = $(this).serialize(); var sUrl = "http://localhost/stuff"; $.ajax({ url: sUrl, type: "POST", data: serialized, success: function(data) { alert(data); } }) return false; }); }); CodeIngiter(PHP) side: function stuff() { $post_stuff = $this->input->post('my_stuff'); // WORKS PERFECTLY $user_id = $this->session->userdata('user_id'); // RETURNS NULL } Where commented returns NULL it should return users session data, because it really exists. What is the problem? Method post doesn't get cookies or what? Thanks for any help!

    Read the article

  • codeIgniter: pass parameter to a select query from previous query

    - by krike
    I'm creating a little management tool for the browser game travian. So I select all the villages from the database and I want to display some content that's unique to each of the villages. But in order to query for those unique details I need to pass the id of the village. How should I do this? this is my code (controller): function members_area() { global $site_title; $this->load->model('membership_model'); if($this->membership_model->get_villages()) { $data['rows'] = $this->membership_model->get_villages(); $id = 1;//this should be dynamic, but how? if($this->membership_model->get_tasks($id)): $data['tasks'] = $this->membership_model->get_tasks($id); endif; } $data['title'] = $site_title." | Your account"; $data['main_content'] = 'account'; $this->load->view('template', $data); } and this is the 2 functions I'm using in the model: function get_villages() { $q = $this->db->get('villages'); if($q->num_rows() > 0) { foreach ($q->result() as $row) { $data[] = $row; } return $data; } } function get_tasks($id) { $this->db->select('name'); $this->db->from('tasks'); $this->db->where('villageid', $id); $q = $this->db->get(); if($q->num_rows() > 0) { foreach ($q->result() as $task) { $data[] = $task; } return $data; } } and of course the view: <?php foreach($rows as $r) : ?> <div class="village"> <h3><?php echo $r->name; ?></h3> <ul> <?php foreach($tasks as $task): ?> <li><?php echo $task->name; ?></li> <?php endforeach; ?> </ul> <?php echo anchor('site/add_village/'.$r->id.'', '+ add new task'); ?> </div> <?php endforeach; ?> ps: please do not remove the comment in the first block of code!

    Read the article

  • PHP/Codeigniter processing a list with javascript

    - by user270797
    I have a list of items that the user can select. I want it to be more user friendly than standard checkboxes so I have seperate div's each with a unique id. When user clicks an item, I use javascript to display a tick on top of that item and change the style to show that it is highlighted. Im trying to work out how I can pass the list of id's when the form is submitted. Remember, if the user unticks an item, it should be removed from the list, I was thinking of using comma seperated values in a hidden text field but couldnt work out how to remove items from the start of the list if they were deselected

    Read the article

  • codeigniter and form action trailing / issue??

    - by alex
    Hi, I am having a bit of an issue with the way CI is dealing with /. In a regular form i notice that the following form action didn't work action="mydomain.com/ci-controller/login/" but this one does work action="mydomain.com/ci-controller/login" Strange but he it worked. But now i need this from a iframe, i the iframe i have a login form which sets the parents url to mydomain.com/ci-controller/login, but i get the same error as it was calling mydomain.com/ci-controller/login/ Could my problem be that the call from the iframe adds a trailing / which is not visible?? Any thoughts

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >