Search Results

Search found 981 results on 40 pages for 'codeigniter 2'.

Page 9/40 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Validating single form field with CodeIgniter

    - by iamdadude
    Is there a quick way to validate a single form field with CodeIgniter to see whether or not that field matches a set of rules? There's the $this-form_validation-run();, but that will return either TRUE or FALSE for the whole form, and that's just not what I'm looking for. For example, if I only wanted to check if the email was valid, checking the whole form is not going to get me the result I'm looking for. I looked through the documentation but couldn't find anything like $this-form_validation-run(); that accepts one parameter and returns TRUE or FALSE if it's valid.

    Read the article

  • Best practice for error handling in codeigniter / php apps

    - by Industrial
    Hi everyone, We're working with a new codeigniter based application that are cross referencing different PHP functions forwards and backwards from various libraries, models and such. We're running PHP5 on the server and we try to find a good way for managing errors and status reports that arises from the usage of our functions. While using return in functions, the execution is ended, so nothing more can be sent back. Right? What's the best practice to send a status information or error code upon ending execution of actual function? Should we look into using exceptions or any other approach? http://us.php.net/manual/en/language.exceptions.php

    Read the article

  • CodeIgniter version 2.0 is stable enough to use?

    - by ajsie
    i want to port my application to CodeIgniter but i am wondering whether i should use their v2.0 or v1.72 (then when they release 2.0, upgrade it). i have never used a framework before so i don't exactly know what implies when upgrading a framework: what does it mean practically - i just move the folders and it will work? or do i have to change a lot of settings, file structure etc? could someone enlighten me about the upgrade process. and what would you use: v.1.72 or v2.0? if i'm using the latest version, is there a good documentation for it somewhere so you can read about how to use the new features: packages, drivers and so on. thanks

    Read the article

  • Codeigniter Model appending word_limiter to result object

    - by yahyaE
    I have a get_all function in my model class in Codeigniter 2.0+. For a given database field name, i need to use word_limiter() in text helper. In view page, i loop result set as object $row->field_name_to_be_limited. With below code, i am trying to do it. But i should include the change $q->$field_name = word_limiter($q->$field_name, 4); into the $q->result. Thanks for help. function get_all($table_name,$orderByField,$ascDesc,$field_name = '') { $this->load->helper('text'); $qOrder = $this->db->order_by($orderByField,$ascDesc); $q = $this->db->get($table_name,$qOrder); if( ! $field_name ==='') $q->$field_name = word_limiter($q->$field_name, 4); return $q->result(); }

    Read the article

  • Codeigniter deny access to directory of controllers with apache config

    - by MAZUMA
    I’d like to restrict access to a folder of controllers that are used for admin purposes only. I’ve tried a number of ways and not coming up with a solution. These controllers are behind password protection. But, I’d like to just remove it from view if someone happens to stumble upon the right directory. Can this be done? I’d rather not do it from htaccess. I have access to the apache config files, so I’d like to handle it there. Does it have anything to do with the way Codeigniter routes? Or, am I just way off? This what I’m using that doesn’t work <Directory /var/www/application/controllers/folder/> Order deny,allow Deny from all Allow from xxx.xxx.xxx.xxx </Directory>

    Read the article

  • please explain the dataflow in MVC specially in codeigniter

    - by pokhara
    Dear friends, Can anyone please explain me the object flow in codeigniter MVC ? I can see for example when I put the followong code in controller it works, but i am not being able to figure out which part of this goes in model in vews. I tried several ways but coudn't. When i use the example codes from other it works but myself i am getting confused. Please help $query = $this->db->query("YOUR QUERY"); foreach ($query->result() as $row) { echo $row->title; echo $row->name; echo $row->body; }

    Read the article

  • Codeigniter setting multiple where conditions, how to unset one

    - by Dustin
    I've got a script that is a notify_url from paypal that is supposed to update multiple tables in my database using the following code: //update first table $this-db-where('someid', $somid); $this-db-update('table', $data); ///update second table $this-db-where('somesecondid', $somesecondid) $this-db-update('anothertable', $data2); Then I get the following error: Unknown column 'somesecondid' in 'where clause' UPDATE anothertable SET avail = 0 WHERE someid = '13' AND somesecondid = '199' So codeigniter is combining those where clauses into a single query. Is there a way to unset the first one so it only has "UPDATE anothertable SET avail=0 WHERE somesecondid = 199" ? Thanks!

    Read the article

  • how to read csv file in jquery using codeigniter framework

    - by webghost
    suppose this is my csv file fileempId,lastName,firstName,middleName,street1,street2,city,state,zip,gender,birthDate,ssn,empStatus,joinDate,workStation,location,custom1,workState,salary,payFrequency,FITWStatus,FITWExemptions,DD1Routing,DD1Account,DD1Amount,DD1AmountCode,DD1Checking,DD2Routing,DD2Account,DD2Amount,DD2AmountCode,DD2Checking 1,Dela Cruz,Juano,Santos,,,,,,1,,,Part Time Internship,, asd Division, Makati,one, asd,150,Bi Weekly,Not Applicable,100,,,,,,1234,9876,100,SAVINGS,BLANK 3,Palogan,Ralph,,,,,,,1,11-Mar-11,,Full Time Contract,2-Mar-11, sdf Department, pasay,, ,,,Not Applicable,,,,,,,,,,, 5,San,Goku,,,,hidden leaf,,,1,11-Mar-11,,,,,,,,,,Not Applicable,0,,,,,,,,,, this is my form <label>Choose File:</label><font color="#FF0000">*</font> <input type="file" name="file" id="file" /> <input type="button" id="importButton" value="Import" name="importButton" /> how to read the data in csv and store it to mysql database(codeigniter)? Any example code on how to do it,.

    Read the article

  • Content cacheing with PHP and CodeIgniter

    - by Josh K
    I have a couple of things I'm working on, namely a page that issues five or six cURL requests and processing content on them. I'm working with CodeIgniter on a LAMP stack but am open to other options. Naturally I would prefer to not rewrite the application. I would like to know if there are any ready-made / easily learned caching methods. Primarily I'd like to check if the page has changed since I last scrapped it. If it has, redownload and present. If it hasn't, serve up a cached copy.

    Read the article

  • CodeIgniter | direct Echo during working script

    - by Sep O Sep
    Is it possible to echo something while the script for example is still running in a loop? my problem: I ask the server with Ajax and then the server is fetching mails and store them in Database. This took around 15 sec. During that Time the Server should echo his progress so that the Javascript can update a loading bar. This is working with a php script without CodeIgniter well. Is there a way to skip the output class and all that stuff to get a direct echo? Thanks

    Read the article

  • convert mysql code to codeigniter

    - by Jethro Tamares Doble
    How can i convert this code into an acceptable codeigniter code: mysql_select_db($database_connection_ched, $connection_ched); $query_Institutions = "SELECT * FROM tb_institutional_profile ORDER BY tb_institutional_profile.institution_name ASC"; $Institutions = mysql_query($query_Institutions, $connection_ched) or die(mysql_error()); $row_Institutions = mysql_fetch_assoc($Institutions); $totalRows_Institutions = mysql_num_rows($Institutions); <td width="192"><select name="institution_id"> <?php do { <option value="<?php echo $row_Institutions['institution_id']?>" ><?php echo $row_Institutions['institution_name']?></option> <?php } while ($row_Institutions = mysql_fetch_assoc($Institutions)); ?> </select></td>

    Read the article

  • CodeIgniter - Returning multiple file upload details

    - by Chris
    Hey All, Im using the codeigniter upload library to upload multiple files, which works fine ... What im having problems with is returning the information about the files. Im using the following code to print the results for testing echo '<pre>'; print_r($this->upload->data()); echo '</pre>'; A cut down version of the results are as follows Array ( [file_name] => Array ( [0] => filename1.gif [1] => filename2.jpg ) ) The way my view is setup, is that i use jquery to insert multiple dynamic file input fields so the amount of files can be 1, it can be 50 and so on. Im wondering how i would loop through that array to send each filename to the database

    Read the article

  • Connecting to the database in a Created Library - CodeIgniter

    - by Brogrammer
    I have a little issue right now and its bugging me, hopefully one of you guys will be able to help me out. Basically I'm creating a library to use in CodeIgniter and I'm getting this error: A PHP Error was encountered Severity: Notice Message: Undefined property: Functions::$db Filename: libraries/Functions.php Line Number: 11 The Database library is already on autoload aswell as my functions library: $autoload['libraries'] = array('database','session','encrypt','functions'); The Functions.php file is located in the application/libraries folder accordingly. Line number 11 consists of this: $this->db->where('username', $data); Not sure as to why the db is an undefined property?

    Read the article

  • CodeIgniter won't run in a subdirectory

    - by Tim Piele
    I have a CodeIgniter install running in our root web directory that I copied into a subdirectory called /dev... I edited the config/config.php file to reflect the change so it is now like this: $config['base_url'] = 'http://mysite.com/dev'; $config['sbase_url'] = 'https://mysite.com/dev'; $config['default_email'] = '[email protected]'; $config['site_url'] = 'http://mysite.com/dev'; This is my .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> When I hover over any links on the site they are correct, for example the contact us page link reads www.mysite.com/dev/contact but when I click any of the links I get a 404 error... Is there something common I am missing?

    Read the article

  • How to handle redirections with codeigniter?

    - by SinneR
    Hi, im having problems starting a codeigniter project, the problem is that when i do something in a controller and then i want a page to display the result, an example: i have a form to add a item to the database, i get all the data in the controller and save it to database and then i want (if all went well) to redirect to the main page with a success msg, i was doing this with $this->load->view('admin', $data); the problem is that the url keeps saying admin/addItem so everytime the page gets refreshed it adds another item, now i found the: redirect('admin','refresh'); but this only helps me when i dont need to display any msg because this function dont allow to send a $data var. Any ideas? Probably this is really easy to fix but i cant find a way to handle the flow of the application the way i want, any help is apreciated. thanks ;)

    Read the article

  • PHP Codeigniter error: call to undefined method ci_db_mysql_driver::result()

    - by Ronnie
    I was trying to create an xml response using codeigniter. The following error gets thrown when i run the code. This page contains the following errors: error on line 1 at column 48: Extra content at the end of the document <?php class Api extends CI_Controller{ function index() { $this->load->helper('url', 'xml', 'security'); echo '<em>oops! no parameters selected.</em>'; } function authorize($email = 'blank', $password = 'blank') { header ("content-type: text/xml"); echo '<?xml version="1.0" encoding="ISO-8859-1"?>'; echo '<node>'; if ($email == 'blank' AND $password == 'blank') { echo '<response>failed</response>'; } else { $this->db->where('email_id', $email); $this->db->limit(1); $query = $this->db->from('lp_user_master'); $this->get(); $count = $this->db->count_all_results(); if ($count > 0) { foreach ($query->result() as $row){ echo '<ip>'.$row->title.'</ip>'; } } } echo '</node>'; } } ?>

    Read the article

  • Jqgrid + CodeIgniter

    - by Ivan
    I tried to make jqgrid work with codeigniter, but I could not do it, I only want to show the data from the table in json format... but nothing happens.. but i dont know what i am doing wrong, i cant see the table with the content i am calling. my controller class Grid extends Controller { public function f() { $this->load->model('dbgrid'); $var['grid'] = $this->dbgrid->getcontentfromtable(); foreach($var['grid'] as $row) { $responce->rows[$i]['id']=$row->id; $responce->rows[$i]['cell']=array($row->id,$row->id_catalogo); } $json = json_encode($responce); $this->load->view('vgrid',$json); } function load_view_grid() { $this->load->view('vgrid'); } } my model class Dbgrid extends Model{ function getcontentfromtable() { $sql = 'SELECT * FROM anuncios'; $query = $this->db->query($sql); $result = $query->result(); return $result; } } my view(script) $(document).ready(function() { jQuery("#list27").jqGrid({ url:'http://localhost/sitio/index.php/grid/f', datatype: "json", mtype: "post", height: 255, width: 600, colNames:['ID','ID_CATALOGO'], colModel:[ {name:'id',index:'id', width:65, sorttype:'int'}, {name:'id_catalogo',index:'id_catalogo', sorttype:'int'} ], rowNum:50, rowTotal: 2000, rowList : [20,30,50], loadonce:true, rownumbers: true, rownumWidth: 40, gridview: true, pager: '#pager27', sortname: 'item_id', viewrecords: true, sortorder: "asc", caption: "Loading data from server at once" }); }); hope someone help me

    Read the article

  • Codeigniter + TankAuth + Swfupload not able to get the logger user id

    - by Manny Calavera
    Hello. I am using Codeigniter with the TankAuth library installed and trying to upload to index.php/reuqests/doUpload from swfupload but can't access the page as authenticated. I have read many posts around the net about similar problem and tried to set $config['sess_match_useragent'] = FALSE; but still no difference. I have ended up skipping the login check in my controller for testing purposes. But now I need to access tankAuth library from my controller to get the current logged in user ID. It is requested in my application and cannot skip it, I really need to pass the logged in user id to that doUpload model. I have setup controller like this: function doUploadFileFn() { if (!$this->tank_auth->is_logged_in()) { return; } else { $user_id = $this->tank_auth->get_user_id(); $this->load->model('requests/doUploadFile'); $this->doUploadFile->uploadData($user_id); } } Now, it does not pass the is_logged_in() check, as I learned from other posts, CI deletes the session but I have setup the config not to match the user agent but still not working. Is there any solution to this out there ? Thank you.

    Read the article

  • Rewriting URL's in codeigniter with url_title()?

    - by Craig Ward
    I am rewriting my website with codeigniter and have something I want to do but not sure it is possible. I have a gallery on my site powered by the Flickr API. Here is an example of the code I use to display the Landscape pictures: <?php foreach ($landscapes->photoset->photo as $l->photoset->photo) : ?> <a >photoset->photo->farm ?>/<?php echo $l->photoset->photo->server ?>/<?php echo $l->photoset->photo->id ?>/<?php echo $l->photoset->photo->secret ?>/<?php echo $l->photoset->photo->title ?>'> <img class='f_thumb'>photoset->photo->farm ?>.static.flickr.com/<?php echo $l->photoset->photo->server ?>/<?php echo $l->photoset->photo->id ?>_<?php echo $l->photoset->photo->secret ?>_s.jpg' title='<?php echo $l->photoset->photo->title ?>' alt='<?php echo $l->photoset->photo->title ?>' /></a> <?php endforeach; ?> As you can see when a user clicks on a picture I pass over the Farm, Server, ID, Secret and Title elements using URI segments and build the page in the controller using $data['farm'] = $this->uri->segment(3); $data['server'] = $this->uri->segment(4); $data['id'] = $this->uri->segment(5); $data['secret'] = $this->uri->segment(6); $data['title'] = $this->uri->segment(7); Everything works and is fine but the URL’s are a tad long, example “http://localhost:8888/wip/index.php/gallery/focus/3/2682/4368875046/e8f97f61d9/Old Mill House in Donegal” Is there a way to rewrite the URL so its more like “http://localhost:8888/wip/index.php/gallery/focus/Old_Mill_House_in_Donegal” I was looking at using: $url_title = $this->uri->segment(7); $url_title = url_title($url_title, 'underscore', TRUE); But I don’t seem to be able to get it to work. Any ideas?

    Read the article

  • Codeigniter image manipulation class rotates image during resize

    - by someoneinomaha
    I'm using Codeigniter's image manipulation library to re-size an uploaded image to three sizes, small, normal and large. The re-sizing is working great. However, if I'm resizing a vertical image, the library is rotating the image so it's horizontal. These are the config settings I have in place: $this->resize_config['image_library'] = 'gd2'; $this->resize_config['source_image'] = $this->file_data['full_path']; $this->resize_config['maintain_ratio'] = TRUE; // These change based on the type (small, normal, large) $this->resize_config['new_image'] = './uploads/large/'.$this->new_file_name.'.jpg'; $this->resize_config['width'] = 432; $this->resize_config['height'] = 288; I'm not setting the master_dim property because the default it set to auto, which is what I want. My assumption is that the library would take a vertical image, see that the height is greater than the width and translate the height/width config appropriately so the image remains vertical. What is happening (apparently) is that the library is rotating the image when it is vertical and sizing it per the configuration. This is the code in place I have to do the actual re-sizing: log_message('debug', 'attempting '.$size.' photo resize'); $this->CI->load->library('image_lib'); $this->CI->image_lib->initialize($this->resize_config); if ($this->CI->image_lib->resize()) { $return_value = TRUE; log_message('debug', $size.' photo resize successful'); } else { $this->errors[] = $this->CI->image_lib->display_errors(); log_message('debug', $size.' photo resize failed'); } $this->CI->image_lib->clear(); return $return_value;

    Read the article

  • PHP Codeigniter Undefined Offset Error

    - by Matt
    Hello, I am building a Codeigniter shopping cart. On the cart details page I have a form input field allowing the user to type in the quantity required of a product, and a submit button to post the information to the update function. When there is just one item in the cart, when updating the quantity everything works as it should. However, when there is more than one item, changing the quantity of an item and clicking submit results in a ‘Undefined Offset 1: error on the following code in the Model (specifically the two lines within the array) : function validate_update_cart() { $total = $this->cart->total_items(); $item = $this->input->post('rowid'); $qty = $this->input->post('qty'); for($i=0;$i < $total;$i++) { $data = array( 'rowid' => $item[$i], 'qty' => $qty[$i] ); $this->cart->update($data); } } This is the View code to which the above refers: <form action="<?php echo base_url(); ?>home/update" method="post"> <div><input type="hidden" name="rowid[]" value="<?php echo $item['rowid']; ?>"/></div> <div><input type="text" name="qty[]" value="<?php echo $item['qty']; ?>" maxlength="2" class="chg-qty"/></div> <div><input type="submit" value="update" class="update-quantity"/></div> </form> And this is the Controller: function update() { $this->products_model->validate_update_cart(); redirect('cart'); } Please can anyone explain why this is happening? Many thanks, Matt

    Read the article

  • CodeIgniter, Godaddy, htaccess passing variable through url, HMVC

    - by user1492738
    I have a new controller in a module created with HMVC (admin), but i tried also without HMVC and the same issue. I am trying to pass a variable to index or another method from controller but when i access it i receive 404 error, not found. I am new to Codeigniter. I am trying to do resolve this since yesterday, please help me :) Thank you! Route: $route['default_controller'] = 'pages/view/home'; -- working $route['(:any)'] = "pages/view/$1"; -- working $route['404_override'] = ''; -- working $route['admin'] = 'admin/index'; -- working $route['admin/list'] = 'admin/list_pages/index'; -- working $route['admin/edit/(:any)'] = 'admin/edit/index/$1'; -- this is the problem, the other rules are working HTACCESS: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L] Controller: class Edit extends CI_Controller{ function __construct() { parent::__construct(); $this->load->model('pages_model'); } function index($id = 0){ $data['page'] = $this->pages_model->get_pages_by_id($id); $this->load->view('header', $data); $this->load->view('edit', $data); $this->load->view('footer', $data); } } Config: $config['base_url'] = ''; $config['index_page'] = 'index.php?'; $config['uri_protocol'] = 'QUERY_STRING';

    Read the article

  • Wildcard subdomain .htaccess and Codeigniter

    - by Gautam
    Hi All, I am trying to create the proper .htaccess that would allow me to map as such: http://domain.com/ --> http://domain.com/home http://domain.com/whatever --> http://domain.com/home/whatever http://user.domain.com/ --> http://domain.com/user http://user.domain.com/whatever --> http://domain.com/user/whatever/ Here, someone would type in the above URLs, however internally, it would be redirecting as if it were the URL on the right. Also the subdomain would be dynamic (that is, http://user.domain.com isn't an actual subdomain but would be a .htaccess rewrite) Also /home is my default controller so no subdomain would internally force it to /home controller and any paths following it (as shown in #2 example above) would be the (catch-all) function within that controller. Like wise if a subdomain is passed it would get passed as a (catch-all) controller along with any (catch-all) functions for it (as shown in #4 example above) Hopefully I'm not asking much here but I can't seem to figure out the proper .htaccess or routing rules (in Codeigniter) for this. httpd.conf and hosts are setup just fine. EDIT #1 Here's my .htaccess that is coming close but is messing up at some point: RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).domain [NC] RewriteRule (.*) index.php/%1/$1 [QSA] RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L,QSA] With the above, when I visit: http://test.domain/abc/123 this is what I notice in $_SERVER var (I've removed some of the fields): Array ( [REDIRECT_STATUS] => 200 [SERVER_NAME] => test.domain [REDIRECT_URL] => /abc/123 [QUERY_STRING] => [REQUEST_URI] => /abc/123 [SCRIPT_NAME] => /index.php [PATH_INFO] => /test/abc/123 [PATH_TRANSLATED] => redirect:\index.php\test\test\abc\123\abc\123 [PHP_SELF] => /index.php/test/abc/123 ) You can see the PATH_TRANSLATED is not properly being formed and I think that may be screwing things up?

    Read the article

  • jQuery ajax success not work in codeigniter

    - by softboxkid
    I had a problem with ajax. The trick is, when user click on the top hyperlink, it will send the link id through onclick=getChildMenuLink(str). Then from getChildMenuLink(str) function, it will send the str to the controller (to set the session) thru ajax. here is the code. html code <a href="http://localhost/ejournal/index.php/sysconfig" onclick="getChildMenuLink(1)">Administrator</a> <a href="http://localhost/ejournal/index.php/welcome" onclick="getChildMenuLink(22)">Home</a> jquery ajax function getChildMenuLink(str) { 'use strict'; $.ajax({ type: 'POST', url: "http://localhost/ejournal/index.php/sysconfig/getLink/" + str, success: function () {} // End of success function of ajax form }); // End of ajax call //alert(document.URL); } codeigniter controller function getLink($id='') { $this->session->unset_userdata('parentLink'); $this->session->set_userdata('parentLink',$id); } if i uncomment the alert() function on that script, it work. the PHP session is properly set. please help me

    Read the article

  • Right way of making muti-site and multi-lingual website on codeigniter

    - by DR.GEWA
    Hi there. Beforehand let me thank you all !! Really guys you help a lot. When I will finish my web site and will have much time on watching how userbase is growing I will come here again and again to answer to another people questions(if I can ) So here is the problem. I made a web-site on CodeIgniter. A social network engine. Something like phpfox, classmates_com or facebook. It's right now somehow not multilingual, So the UI strings are in the view files, and next step will be move them to the language files. I want the user to have ability to change the language. So I assume that in database user will have row "lang_local" which would be by default set to en, and then to any other language he will change . So what is eating my nervs and enery is following. I will make on this engine several demographic social networks,and I would like to manage theese web-sites in centralized manner with one backend . So whenever I would like to make a new web-network, I just add the domain settings install the script in new folder and add it in database sites I see it like this on every table in database like users,comments,messages,categories ,etc I will have a row site_id , and on each query add/update/delete I add a WHERE SITE_ID=XXX and in table sites(site_id,site_name,domain_name) will have all domains , so that in backend I can filter data by website. Is this a good way? What if i will need then to be multiserver, what about load balancing? Who can tell me what would be a right,PROFESSIONAL way? My maximum user limit for a database is something like for start 10.000 in one-two year 100.000users

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >