I am trying to create a list of users in the database of volunteers, based on those who are active members, and which jobs they volunteer for. problem is, it is including inactive members as well. Here is my controller Here is my model It seems that the or_where is completely overriding the where != DNR (Did not Renew) Help!
Tag: codeigniter
Content length for code igniter view
Is it possible to get the length of the data that will be sent to browser when a view file is loaded? For example, I would like to know the content length that should be sent to browser. Since the data sent can also be an array, it might increase the length of the HTML content. It is unlikely that
CodeIgniter – Process Simple XML & PHP
in the controller I have _send method. This method returns something like below: This method called: I am unable to create array or object suitable for passing to model for inserting into DB. Below what I have now. I am attempting to achieve something like this array: Problem with error attribute with fault array_merge. Any ideas? Answer This is how
How to use confirm box in php codeigniter inside a function of a controller?
I have written something like this. Now I want to delete something but I want user to confirm it before deletion. This function is inside controller. Answer You can simply provide the JavaScript code when generating the button, link, or whatever needs confirmation. Example: That way the link / button would be activated only if the user presses ‘OK’ in
Update specific row using codeigniter?
I am trying to update specific row of table in codeigniter. But my code update all rows. Model: Controller: And in new page it show the echo value 1. How to update specific row? why $query->num_rows() return 1 and update all rows? Answer Try using a where condition to update a specific record
Should I be unit testing every piece of code
I have been starting unit testing recently and am wondering, should I be writing unit tests for 100% code coverage? This seems futile when I end up writing more unit testing code than production code. I am writing a PHP Codeigniter project and sometimes it seems I write so much code just to test one small function. For Example this
Codeigniter or_where_in
I am trying to combine these two queries in Codeigniter. So the row either has to have the user_id of $user eg 3 OR have an id matching the array $repost. I know how to do or_where but how do you do or_where_in? Thanks Answer Syntax: Parameters: Returns: Return type: Generates a WHERE field IN(‘item’, ‘item’) SQL query, joined with
Codeigniter Rename file on upload
I’m trying to add time as the prefix of the image name along with the original name when uploading, But I couldn’t figure it out. Please help me with the following code to add a prefix to my original file name when uploading. Answer You can encrypt file name with use of CI native option: OR You can do it
jQuery UI sortable images
Hi I ‘d like some help please, as my skills in jQuery are not so good. What I want to achieve is to change the order of the images like this example. My database looks like this: I have also created these 2 views: index.php order_ajax.php I have also created and the order_ajax controller So what I basically want to
Custom config file for codeigniter
Very new to CodeIgniter, trying to create a custom config file to load special variables into my application. in application/config/ I created custom.php and placed the following code in that file: I then opened up application/config/autoload and altered the following code: I refresh my application and see this error: I opened up some of the default config files and don’t