CodeIgniter From Scratch: Day 5
videos

CodeIgniter From Scratch: Day 5 – CRUD

This entry is part 5 of 17 in the CodeIgniter From Scratch Session
« PreviousNext »

The most requested tutorial for day five of our CodeIgniter screencast series was for an introduction to CRUD operations. We’ll review how to easily create, read, update, and delete records using CI’s active-records class.

Catch Up

Day 5: CRUD Operations


Tags: Videos
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.google.com Bob

    WOW :)

    • tomx

      That’s a very applicable info to our current vigilon project.

  • Andrew

    Finally!! I’ve been waiting so long for this!

    Thanks alot, I’m going to watch it right now

  • Alexander

    Been looking forward for this one! Keep up the good work Jeffrey and thanks for this great series :)

  • http://eyoosuf.blogspot.com Yoosuf

    its awsome!!!, @jeff keep it up

  • http://pxexp.com RoMuLauM

    Hello! Please make a itunes feed for this screencasts! I don’t have internet all time for watching… thanks for this screencasts!

  • http://laranzjoe.blogspot.com lawrence77

    What happen to Blip Tv… :(

    • Jeff Way

      Screencast.com is far superior.

      • http://blog.pdwd.net Paul Davis

        The audio & video aren’t synced for me. I personally prefer Blip.tv. But hey, I’m just one guy.

      • http://www.jeff-way.com Jeffrey Way
        Author

        Strange. Just watched the video last night, and everything appeared to be synced.

      • Aditu

        What do you use to watch your videos?

        I watch your videos using Media Player Classic on Windows – i found nothing wrong with last file although the file format changed.

      • Aditu

        The file is broken. Read my other post about media players.

      • http://gravityfx.org/ emcgfx

        I personally use only VLC in both linux and windows. When watching offline screencasts.

      • http://gravityfx.org/ emcgfx

        Hey Jeff, I’ve finished all the videos you have posted on CodeInginter. CRUD was the last one today. Thank you so much for creating this videos, it helps me to learn a lot from you. You explain all the code in detail. A bit fast at times, I need to pause a lot to catch up. But I understood everything.

        The next video would be nice about “Pagination” where you grab contents from database and show only limited amount of contents per page. Also, in the following videos, it would be nice if you could teach us how to properly make admin control panel or at least login/logout/register with sessions etc… Thank you.

      • adelle

        I totally agree .. What about a simple but full example (That puts it all together ) ?

      • iPad

        No Jeffrey, You can’t control volume and is more slowly.

      • spartcaus

        i prefer Blip.tv because it can be subscribed with iTunes. i’ll appreciate if you would upload it there too.

        thanx for all the screencasts!

      • Meshach

        Personally I think the new player is a downgrade because whenever you try to move the slider it pops up and says “replay video”.

      • http://www.nouveller.com/ Benjamin Reid

        Errr… Vimeo FTW.

      • Anon

        blip TV always had problems for me

  • http://webmuch.com Aayush

    I think i’ll pick CI for my current project…only designing right now…let’s see when I start developing….

    hopefully it will help me build it faster….

  • http://lifesizedesign.net Andrew

    Great work Jeff. Now that I’m all caught up, found myself sitting around waiting for this.

    Cheers

  • http://milesj.me/ Miles Johnson

    Sigh I really hate video tutorials. Just give me the code and ill figure it out myself, I hate sitting through people yabbing about it.

    • Ulrik

      Source code??

    • http://www.jeff-way.com Jeffrey Way
      Author

      The source code is available to you.

    • james

      “here, i baked you a birthday cake and it cost you absolutely nothing”

      “sigh. i hate chocolate. take it back. ice cream cake next time. jeez.”

      miles. nice guy!

    • Sid

      “hi, my name is miles johnson. here, i put my face on my avatar just to show you guys what a lazy, ungrateful prick looks like”.

      seriously, do you realize what “source code” means? it’s always right there at the top – you don’t even have to scroll down to the video if it’s not your thing.

      • http://www.milesj.me/ Miles Johnson

        I meant the code in the actual article. I don’t want to download some zip, then unzip it, then open to realize the code was crap. Theres no reason to not put the code in the article itself.

      • mike

        Great Miles, Any reason why you are watching Jeff’s tutorials if you are such a good coder? One could be mistaken that you were not such a good coder if your watching these basic tutorials.

        Jeff’s code is not crap, it is easy, readable & does what it says on the tin. Exactly how a tutorial should be, no?

    • http://noahhendrix.com Noah Hendrix

      Personally I prefer screencasts because they show you a more accurate view of what working through a tutorial is like, users don’t get lost in the words when they can just watch you do it, but hey to each his own I suppose.

    • mike

      Then Dont Watch? I Hate people who do things they hate.

    • Johnny Bravo

      What an asshole!!
      Miles go play with your dolls or something!!

    • GafroNinja

      I have an idea Mr Miles Johnson… don’t come here :D Then everyone is happy!

      • F’ugly MJ

        In fairness to Miles, I’d be a pretty angry passive aggressive too if I had a head like that.

  • Caleb

    Great information. I would like to see more on updating records using a form with elements like drop downs and check boxes along with normal text. I know you ran out of time during this session but it has something that I think would be very useful in many projects.

    As always great job.

  • netuser

    I’m on a low bandwidth connection and as streaming and following the tutorials are not a practical option, used to download screencasts from blip.tv, but now no idea how to do it.

    • http://www.jeff-way.com Jeffrey Way
      Author

      Just added a download link underneath the video. Hope this helps. :)

      • netuser

        @Jeff
        Thanks a lot for the download link, you rock !!!

      • webn

        Thanks for that link and for the nice series..

  • james

    Jeff, this series has been extremely helpful. I’d buy you a beer if I could. Thanks buddy.

  • http://fwebde.com/ Eric B.

    I love you, Jeff!

  • http://www.webeventures.com Prabhjeet

    its good.

  • http://www.ifadey.com iFadey

    Great work Jeff. I love CodeIgniter :)

  • Javed Gardezi

    Great JW continue on … love this series
    I was waiting for it for so long……….. :)

    If it’s possible please provide us the title of the next screen cast too at the end of each episode.

  • Aaron

    hey thanks Jeff…. glad to see this up, been hanging out for it! Wont see the wife and kids for a few days now :)

  • http://gravityfx.org/ emcgfx

    Hi, can you please offer all FLV or MOV tutorial files somewhere like in video archive on your web site for download purposes. Because I could not find most of them to download. Like Diving into PHP and others. I really like all the tutorials you create, it helps me learn PHP and CodeIgniter. You explain everything very good. Thank you so much.

  • Emmanuel

    Thanks for this Jeff… it will come in handy!

  • http://www.jeffadams.co.uk Jeff Adams

    Is it wrong that I enjoy CRUD so much, its like the building blocks of all webapp life lol. To think it was so damn hard a few years ago…

  • http://gravityfx.org/ emcgfx

    I’m only starting learning CRUID, and already starting to love it :) So no, its not wrong Jeff.

  • http://www.kriesi.at Kriesi

    great as always, looking forward to the upcoming codeigniter tuts :)

  • http://gravityfx.org/ emcgfx

    Can you please add direct links to your videos. I like to watch them offline on my laptop. Thank you.

  • http://www.hobbes.ch tkhobbes

    Hi Jeff, absolutely great stuff, I think this is much more useful than the e-mail stuff :)

    Anyway, what I’d love to see next time are things like
    - get a grip on the update function (obviously – would like to see how to use it properly, by filling existing info into a form and then let the users override it)
    - understand how to build more complex models – e. g. in a blog, you might have categories and you want to create categories and assign posts to a category (which you could select in a drop down or by checkboxes or similar)
    - anyway, you promised that we would ultimately end up at a full blown cms-system – guess I am just waiting to get there in the long row :)

  • http://Deanperry.net Dean

    Am I able to download the videos from screencast.com ?
    Just so I can watch them when I’m not online. Cheers

    • Guillermo Carrion

      I believe you can… using something like OrbitDownloader…

      • http://www.jeff-way.com Jeffrey Way
        Author

        Just added a download link. Look underneath the video.

  • Rodge

    i simply love this serie!

  • Shillo

    This is really fun.
    But for some reason it can’t find the “db” property:

    Message: Undefined property: Site_model::$db

    Filename: models/site_model.php

    Line Number: 15

    • http://www.jeff-way.com Jeffrey Way
      Author

      Did you remember to auto load the database class – within the “autoload.php” file inside the “Config” folder?

  • http://meito.22web.net adai

    why not provide the url for downloading the vidioes?

    • http://www.jeff-way.com Jeffrey Way
      Author

      Just added a download link underneath the video.

  • http://meito.22web.net adai

    Think you ,I find the way to do what I want…

  • Guillermo Carrion

    Been waiting for this one… thanks!

  • Oliver

    hey :) thank you very much, I watched every single video. great stuff. what I’d like to see in this series is some ajax combined with CI ;) would have been great for this one.

    keep it up & cheers

    • http://www.drewbarontini.com Drew Barontini

      I concur. I want to see some jQuery style Ajax combined wtih CI. I’ve tried to implement it in some projects, but it doesn’t appear to be all that easy.

  • Paul du Long

    Thx for this video!, i was using $this -> db -> query(“UPDATE ….”); (A)

    You can also grap segments trough the function in the controller.
    Example:

    index.php/class/test/variable/var2

    class:

    function test($segment,$segment2)
    {
    echo $segment //Will echo: variable
    echo $segment2 //Will echo: var2
    }


    Offtopic, how did you get your FF so damn fast :O? Is it Mac OS that makes it so fast? Even on localhost a reload takes 2 seconds on my pc :(

    Paul

    • http://blog.davidrojas.net David Rojas

      I was watching the video and stopped it to comment here the same thing about segments ;-) I think that’s the correct approach when Jeffrey is talking about how to deal with the id in the delete method.
      Also, you can chain methods in your db model, like $this->db->where(‘id’, $data)->delete(‘data’);

      Anyway, great video, as usual :-)

  • Jim Martin

    Thanks Jeff,

    These tuts are fantastic, I really appreciate your effort in keeping these going. I am just curious, though, have you gotten this on iTunes yet? I am not seeing it.

  • Aditu

    Good tutorials.

    Please put some more security and encryption stuff.

    BTW why did You change media player (flv changed into mp4)?

  • Aditu

    Good tutorials.

    Please put some more security and encryption stuff next time.

    BTW why the media player changed? (flv changed to mp4, why?)

  • http://blog.davidrojas.net David Rojas

    It isn’t showing on iTunes, do I have to wait for it to update or screencast.com doesn’t provide an iTunes feed?

    • ricochet

      I have also been waiting on the iTunes update…

      • http://net.tutsplus.com Jeffrey Way

        The iTunes version should go up Monday.

      • ricochet

        still waiting… it’s now Tuesday afternoon (AEST)

  • http://www.imblog.info Muhammad Adnan

    can u please Compress your videos for download ? PLUS videos as well.

  • http://no@spam.com barten

    Dont know if its possible but do all this with ajax so we dont have to redirect
    would be a nice thing to learn next:)

  • http://no@spam.com barten

    also security stuff is something i want to learn aswell
    :D

  • Milan

    Hi Jeffrey, thanks for great tutorials.
    I am interested to see some combination of CI and AJAX.

  • http://tutorial-city.net/ Tutorial City

    Day 5 — On update you could use the ‘get_records’ adding a link to a page where you could edit this content and then update it.
    There are hundreds of ways to do it, and in some way it’s nice you didn’t do much, because we can try a couple ways :)

    Day 6 – It would be nice to create a tutorial on how to create an admin area using sessions(cookies and/or database), and the show how to login and logout.

    Great series! ;)

    • Jim Martin

      I agree with Tutorial City about the admin area. That would be a great next step.

    • arnold

      I agree also

    • http://www.philpem.me.uk philpem

      Thirded. I’d love to see a little login/logout/admin area tutorial.

      Maybe with a little bit of info on security (e.g. XSS without using the global XSS filter)?

      Cheers,
      Phil.

      • http://tutorial-city.net/ Tutorial City

        Just use xss_clean(), it’s pretty straightforward.

    • Kevin

      Also think its a good idea to show us how to make a secure login system with CI.

      Nice work btw ;)

  • http://gravityfx.org/ emcgfx

    Hi Jeff, thank you so much for filling my request. By adding direct download link to your video. This will help me a lot, since I wanted to watch your videos offline.
    If you can please continue posting direct links to your videos. Thank you again Jeff for very good tutorials. I think you should be a programming teacher in college if you not already LOL

    • http://net.tutsplus.com Jeffrey Way

      No – problem. I’ll be sure to include a download link from now on. :)

  • Carlos

    What do you search to get the videos from iTunes?

  • timo.huber

    Thanks :)

  • http://www.ideasfactory.lt Vaidotas

    Maybe in Day 6 you’ll be coding Login system?

  • Aditu

    It would be nice to see some session stuf (admin and users with roles) properly secured.

    Also the jQuery and CodeIgniter tutorial is a nice idea. Maybe dynamic login page?

    But to be honest the CRUD tutorial is not complete. What about errors? What about data validation. What about simple silent errors like storing 20 chars into 10 chars field?

  • Aditu

    I checked your video in VLC media player – the audio gets broken at 5:51.

    Same in Media Player Classic. U can skip that part while watching and everything stays fine but i know for sure now that the FILE IS BROKEN. Probably because you made some cut & glue operations on the file.

  • federico bana

    Your videos are excellent, please keep it on.
    I’d appreciate if you make one about session and cookie managing.

    Thanks a lot, really

  • IgnacioRV

    Thanks Jeff for another screencast!
    I didn’t have any problems with the video loading, but not being able to control volume it’s a little annoying (and it went up and down a couple of times during playing)… Anyway, that’s nothing we can’t solve moving up and down the speaker’s volume =P

    One question, does codeigniter have a way to manage the id of the rows. Because in the video, the id field is set to auto_increment in the database, and when you add the first element via CI, it sets it’s id to 16 when the last one was 14 (minute 16:42), which is kinda weird…
    It’s just curiousity, but do you have any idea about what could have happened??

    • IgnacioRV

      Ups, I missed the ? at the end of “does CI have a way to manage the id of the rows?”…

    • http://tutorial-city.net Tutorial City

      Maybe JW set he auto-increment to be ’2′ or he deleted a record before reording. Codeigniter is agnostic about these type of things.

    • arnold

      Im also experiencing the annoying different changes of the volume in the video..

  • James

    Thnx for this great videos…i’ve been following since day 1….