I have a link that calls this function:
function delete($id)
{
//Delete from database
$this->db->delete('messages', array('id' => $id));
$data['delete_message'] = 'Message was successfully deleted';
redirect('admin');
}
As you can see I redirect to the admin function, and I want to pass the delete_message to that ...
how to generate embd code/blgger like widget with CodeIgniter? please give me the idea how to make
...
I have the following types of titles in a table in my db:
Topic 1 blah blah
Topic 2 blah blah
Topic 3 blah blah
...
Topic 10 blah blah
Topic 11 blah blah
etc...
The select query will always return the results like this:
Topic 1 blah
Topic 10 blah blah
Topic 11 blah
...leaving out Topic 2, Topic 3 etc... until after all the teens...
Fairly new to CodeIgniter, still grasping the MVC approach. I'm just wondering what's the best way to solve this:
I got my navigation bar highlighting the currently active link like so:
<a href="index.hml" id="active">Index</a>
<a href="blog.hml">Blog</a>
Now, when I go to blog.html I want id="active" to shift accordingly.
Usually I'...
I have recently added a comments section to a blog. Codeigniter says to always escape data before putting it into the Db.(I do have xss clean on fulltime). Some people say all active record operations are escaped. Am I wasting my time using escape on the function below?
Using the function below I escape the data, but it all comes out ...
I'm an amateur, admittedly so, but I'm having fun trying to learn a little more about programming, and php in general, using CodeIgniter.
I have a test site up and running and feel like I have a decent grasp of MVC. Without any formal background though, I know my architecture is screwy and sloppy so I poll from time to time for best pr...
Alright, Im trying to count all the rows where "Membership_Status" = Active. The result I get right now is "Array" instead of a number.
Here is my model
class Report_model extends Model
{
function count_members()
{
$query = $this->db->get_where('Membership', array('Membership_Status' => 'Active'));
return $query->num_rows();
}
...
I want to implement a sql query using CodeIgniter Active Record class. The query looks like this..
INSERT california_authors (au_id, au_lname, au_fname)
SELECT au_id, au_lname, au_fname
FROM authors
WHERE State = 'CA'
Is this possible in CodeIgniter without using the $this->db->query method?
Solution:
$this->db->select('au_id, au_ln...
Hello all
I have been using .htaccess files to redirect some of my renamed controllers/actions. Say for example...
RewriteRule ^top/index/?(.*)?$ /index.php/home/index/$1 [L]
Can I use the config/routes.php file for the same purpose or is it that routes.php can only be used for URL rewriting or is is that it recognises the controller...
Hi folks!
I have a CodeIgniter/PHP Model and I want to insert some data into the database.
However, I have this set in my 'raw' SQL query:
ON DUPLICATE KEY UPDATE duplicate=duplicate+1
I am using CodeIgniter and am converting all my previous in-controller SQL queries to ActiveRecord. Is there any way to do this from within the Activ...
Hello there , I have some images uploaded in a folder on my server, and their paths are stored
in a table in my database. Whats the best way to display this images on the browser(as a gallery)?Should I use jqery or maybe codeigniter could do the job?Please provide some examples or resources..Thanks!
...
I'm getting this fatal error message:
Fatal error: Can't use method return value in write context in C:\wamp\www\mySite\application\controllers\eventsManager.php on line 115
Could someone tell me what it means?
The line it refers to is this:
$this->session->set_flashdata('alert') = '<ul>'.validation_errors('<li>','</li>').'</ul>';
...
function Home()
{
parent::Public_Controller();
$this->load->library('survey_form_processing');
//Load Helpers
$this->load->helper('form');
$this->load->library('Paypal_Lib');
$this->lang->load('userlib');
$this->load->model('home_model');
if($foo == true){
redirect('home');
}
}
This is my con...
I have an admin controller which has some methods that I want to protect.
http://blabla.com/admin/
http://blabla.com/admin/edit_coupon/
http://blabla.com/admin/edit_photo/
I don't need a full blown authentication system for this site, so I'd prefer to just utilize htaccess and AuthType for any /admin/ URLs.
My current .htaccess is ...
Here's my issue. I am building an application that requires filters. I have gotten the filter system working and I can even pinpoint the actual method i want to access @ the moment. The issue is that I cannot access the CI core from the filter file. I have searched across the web and while I have found some suggested solutions like "Dipp...
I am building a web application that will let users follow discussion threads, in Q&A format. To that end, when displaying questions, I have a "Follow" button next to each question. I want users to be able to follow these threads without reloading the page, thus using AJAX. So, I want the AJAX call to:
1) Submit a form updating the d...
Alright Im trying to retrive the number of rows where members are individual and active.
Ive narrowed the problem to my model. Everything was working fine until I added a second clause to my get_where
Here is my model function
function count_individual_active_members()
{
$query = $this->db->get_where('Membership', arr...
Hi,
I am trying to display a table which contains 8500 records, I am using the same controller/model functions as I have used throughout the site which all work fine.
On this page however, I just see a blank screen. Is this a known Issue with codeigniter? Is there a work around? I am totally stumped, my only option I guess is to split ...
So I have two methods. Method one adds a row to my database. Method two selects and updates the latest 10 rows of the table.
If method one adds a new row after method two selects the data but before it updates it will method two update the wrong 10 rows? Will transactions help here or do i need to lock tables?
function one(){
inser...
I have some CSV files that I need uploaded to a site I'm writing in CodeIgniter.
I need to validate the CSV to make sure they contain various info, column counts match up and stuff like that.
Does CI have any sort of plugin to make this easy?
...