Mike HeaversWeb, Writing, Creative Coding


password protected pages with dynamic redirect after login in codeigniter

Codeigniter provides all of the tools you might need to implement authentication on your website, but it would be a lot of work to create login pages, a user management system, a forgot my password feature, etc. Luckily, Ben Edmunds has developed a great third party authentication system for codeigniter called ion auth which is about as close to plug and play as it gets. The only thing I found necessary to do afterward was to create some method of sending unauthenticated users who access a

...read more

Batch updating mySQL database with AJAX using jQuery and Codeigniter

There’s no shortage of blog posts and stack overflow answers on this, but in trying to accomplish this very common task, I came across a lot of supposed solutions to this, so I thought I’d post the one that worked for me.

Take an array of data:

You want to find the rows in your mySQL database that have this id, and update their name. First you need to conduct the ajax post:

note that for the “data” parameter of our ajax post, we are putting our array into an object with the key “data”.

...read more

Order items in one database table by categories from another database table in PHP (with codeigniter

I came across the need for what has to be a pretty common thing in PHP - you have a list of items in one database table, with a category id. In another table you have a list of those categories and their ids. And you just wanna loop through all the items, and list them out organized by category. So your database looks something like this:

I had a hard time verbalizing (much less coding) this, and it took me a surprisingly long time to work it out, so I decided to post the example that

...read more

More Tutorials >