Get $500+ of the best After Effects files, video templates and music for only $20!
Build a Custom CMS Using PHP and MySQLi: New Plus Tutorial
plus

Build a Custom CMS Using PHP and MySQLi: New Premium Tutorial

Download Source Files

In this video tutorial, we’ll be building a custom Content Management System (CMS) using PHP and MySQLi. We’ll start off by pulling our content from a MySQL database and then build a CMS admin panel to manage our content. For easy content management, we will be using TinyMCE as our editor. I hope you enjoy the screencast. Join today!

Full Website
Admin Panel

Join Tuts Premium

NETTUTS+ Screencasts and Bonus Tutorials

For those unfamiliar, the family of TUTS sites runs a premium membership service called “Premium”. For $19 per month, you gain access to exclusive premium tutorials, screencasts, and freebies at nettuts+, psdtuts+, audiotuts+, and vectortuts+! For the price of a pizza, you’ll learn from some of the best minds in the business. Join today!

  • Subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.


Tags: Premium
Add Comment

Discussion 117 Comments

Comment Page 1 of 21 2
  1. John says:

    glad that I just joined the + section :)

  2. Morten Najbjerg says:

    Isn’t time is better spend learning existing cms’ instead of trying to build your own? Of course You learn some basics – but still.

    Has anyone had customers where this made sense?

    Great idea having a tutorial about TinyMCE though. It’s really a great WYSIWYG.

    • mathew says:

      I agree people should just learn to use existing cms’s instead of reinventing the wheel.

      • Nick Brown says:

        really?

        Why don’t we all just use templates for our websites instead of designing them from scratch.

        Because not only does a custom product address the exact issues and needs of the client, but we learn a great deal in the process of building it.

        I’ve worked with people who spent all their time in pre-built CMSs and many were like fish out of water when a project called for use of a different CMS or a custom solution.

      • Travis says:

        I agree with you Nick Brown, I know how to design and know how to build the backbone of the site (PHP, MYSQL(i), JS), but never learned CSS so its always a fun for me to take projects that require both. I may not learn anything more than I already know PHP and SQL wise, but I always learn something via CSS.

    • wooncherk says:

      That depends… what we learn from building a CMS might apply to other applications as well (provided this tutorial is a good one).

      Many people like to learn the ways to do things… instead of just USING it… they like to know how it’s done…

    • Jeffrey Way says:
      Staff

      That’s like saying, “Why would I convert my PSD when I can pay a company to do it for me?”

      …to learn how to do it!

    • Rik Girbes says:

      I have had 3 customers wich wanted there own CMS-System… wich i had to make…
      So i Do think that this is a Great subject to make an tutorial for

      Ofcourse learning an already existing cms most of the times is good enough, But, for companies/people who want for example there own user system or so, this isn’t always possible with ‘non-cusom cms systems’.

      nevertheless, Nice tutorial, Thanks!

      Rik

    • john says:

      This type work is a very need tutorial. Sure you can get a site running with a CMS that is already out there, however, the problem is that most of them are to complex for a business to keep going. The whole point of a CMS is so a company can manage the content not the developer/designer. So often times the less feature rich more custom tailored application works best.

      Expression engine comes the closest for me because you can define your own weblogs to be anything (what forms fields should show up and the name) , but still often times something more custom tailored is needed. I don’t have a plus membership but if done right this can be a great tutorial. “how to build a custom CMS, tailored to a clients business needs and work flow”. If it is how to make something like wordpress (ie. one solution fits all) then those do already exist.

      • Fynn says:

        I agree.

        I have used Joomla and created my own templates. Added some components and changed their workings a bit by messing with CSS and PHP, which worked pretty all right.

        Thing is, I’m afraid using it for real clients because I don’t have total control over it. I mean, what if the client wants some small changes and I have to tell him/her that I don’t know how to do it…

        I think that’s why a lot of beginning guys like me (at least I am) are afraid of using open source CMS’s and do want to reinvent the wheel. To get an understanding of the basics and to have total control of what you’re making. Also, I agree with John that most CMS’s are way to complex for most projects.

        Besides, I often get the feeling that the people that are promoting those CMS’s most, are excellent webdevelopers themselves that already have a decent knowledge of it’s basics. But correct me if I’m wrong. :)

      • ddorian says:

        That’s like saying, “Why would I convert my PSD when a company can do it for me for free?”
        HINT HINT JEFREY not expression engine around here only open source

      • David Rojas says:

        Totalle agree. Besides with something like Drupal or WordPress I’m always worried about security issues. You have to have it always updated, or else some bug could come up and get your client’s site hacked. If you have a lot of clients, keeping track of every system update is a problem, and then there’s the thing about plugins or modules breaking with new updates. That’s a mess that can be avoided if you build your own custom simple CMS. It still can be hacked, but it would be more difficult since it’s not complex and you have complete control over it, and is not vulnerable to script-kiddies attacks using common published bugs.

    • Ulrik says:

      For small customers and projects ive found it very much easier to just do a simple CMS with simple interface instead of implementing some system which requires som learning and has features not nessecary for a small time internet user.. Thats just my 2 cents

      • Web010 says:

        I agree.

        But not always is needed to “reinvent the wheel”. There are a lot of things same for each project, and i don’t want to retype it every time, i just copy/paste and that’s it.
        Yesterday i was building a website for a customer and he needed CMS, so with few copy/paste and some new coding (which will probably be used on future projects) i made it in less then 10mins.

        So, no need to use Joomla or WordPress or whatever, just make a library of your own scripts for this purpose and that’s it.

        First time you will reinvent the wheel, it won’t be as good as some cms out there, but next time the wheel will not be reinvented again, you will just upgrade it…

    • Copy112 says:

      I needed a custom cms for a while ago, The client needed more control then joomla and drupal offered.

    • Atroxide says:

      If everyone always used the “Why do something that is already done” then there would be no way to improve what we already have.

      In the future some one will need to completely redesign the cms that are popular today, maybe in a different language or maybe to recode it to work with some advance technology in the future.

      There has to be someone to recreate the wheel every now or then to make it better.

      • eCaj says:

        our entire company is using a custom CMS developped from the ground up… It’s working just fine :)

    • cornelius says:

      i wish i could join but the network in Nigeria is frustration, so i cant watch videos, is there any way i can pay so that these materials can be sent? please i need help!

  3. Barry Wood says:

    I just built a custom CMS for a client because there was an extensive database behind the scenes that was used to create pages that would have been impossible to render within the structure of a generic CMS. It was easier to code from scratch rather than to try to beat the CMS into submission.

    Aside from that I totally agree. When the information that needs to be presented can be presented easily by a CMS that’s the way to go. I’ve done custom Joomla sites for clients in those cases.

  4. Paul du Long says:

    Finally a new PLUS tutorial … i was thinking i was PLUS member for nothing. Unfortanally it isnt quiet the subject i was hoping for. Nevertheless a good tutorial!

    Offtopic: How can i edit my avatar??

    • Jeffrey Way says:
      Staff

      Finally? We post a new tutorial each week – every Wednesday. We’ve yet to miss a week since the launch.

      • Hassan says:

        Jeff, I noticed everytime someone says FINALLY you always say that ! lol

      • Paul du Long says:

        I didn’t knew there was a system in it. However more PLUS tuts are always welcome (A). I also hope that there will be more (PLUS) tutorials that will cover more unique and difficulty topics. We just had a CRUD prepared statement what corresponds with this mysqlI.

        I was thinking of topics such as:
        – IRC Chat channel
        – Streaming (server)(webcam)(video) ?
        – Cool JQuery stuff combined with PHP / MYSQL and / or other sorts of cool stuff

      • Hassan says:

        One thing, When are you planning to create some new WordPress Series?

        -Sorry for the double post

      • Yosy says:

        There are a lot of plus tutorials but there is no good screencasts each week :( :(

      • Paul du Long says:

        Yes Jeffrey we’re missing the outstanding screencasts from you!

      • Jeffrey Way says:
        Staff

        @Paul – I’m running out of ideas. :)

        @Yosy – Not sure what you mean. This week’s screencast is excellent.

      • Paul du Long says:

        Why don’t you make a poll for PLUS members to see where they interested in. Or a “dumb-your-tutorial-request” somewhere, there are a lot of subjects to cover. I post some ideas in the reply down here ;)

        Smarty is a good idea, or a newsletter system. If you interested you can contact me :)

      • Scott says:

        I think a tutorial on paginating and pulling in new comments asychrounsuly would be great. Commenting like YouTube and Hulu have, where you click on another page of comments and they load up without a page refresh so not to disrupt the playback of the video you’re watching. I know many other sites do this as well.

    • Jeffrey Way says:
      Staff

      Heh, I do — because it always confuses me.

      • Yosy says:

        “@Yosy – Not sure what you mean. This week’s screencast is excellent.”

        When you started to do screencasts,you made them each week..
        week after week and now you made them once in two weeks ~

      • Ulrik says:

        Is it just me or did last weeks PLUS tutorial not make it to net.tutsplus as a post? The one with the Twitter search api??

  5. Paul du Long says:

    Nevermind … now i see the link Gravatar *stupid*

  6. Paul du Long says:

    More ideas for tutorials:
    – Emailing – PHP Mailer Class (contact me if you want a tut about this)
    – More about template systems (Smarty)

    • Yosy says:

      Yeah!!smarty video tutorial :D
      I think at nettuts+ the problem is what I have saw that the screencasts don’t use enough oop :( and publish tutorials for advanced developers.

    • Paul,

      If ye can do or have a tut about the PHP Mailer Class and Emailing, why not contact the Tuts+ people and offer it to them as a Tut they can use?

      And thanks go to Sunil for this Tut – I’ve got my first web design gig on at the moment and was considering WordPress as the CMS for my client – now I have another option should he not like the WP site / options.

  7. obey says:

    that sounds interesting :)
    might have to think to get a + account

  8. Kasper says:

    Could have been interesting ;(

    Must… have.. plus!

  9. Marc says:

    For the people thinking re-using a ready-made CMS and all that, Customers HATE .. i have lots of them.. HATE paying a couple thousand dollars for something that is free on the internet that you didn’t do much work for. The customers always love to get a custom thing, and then you don’t feel bad charging like 3-4 000$ for it.

    Learning PHP and MySQL that way is a great way. But people .. please… if you are a web professional and a customer wants a CMS .. please don’t use a free open source CMS because lots of times, people don’t learn them and make shitty modules or core changes that make it impossible to update later on.

    Thanks :P

    Nice semi article (i’m not on +)

    • “Customers HATE .. i have lots of them.. HATE paying a couple thousand dollars for something that is free on the internet that you didn’t do much work for.”

      That’s pretty flat out false. We let all our customers know we use the base of drupal to build up and customize their business needs. We fit program logic into drupal, which is why open source is so beneficial because we aren’t spending hours recoding/refining CRUD interfaces and reinventing features that already exist. That and we’re experienced developers so its not that hard.

      If you are selling customers a free CMS without adding anything into it, then they would have a reason to be upset. But from our perspective, we’re making it work for them.

      We had our own CFML CMS a few years ago, but it was impossible to maintain it and keep up with the rest of the world, so we switched to open source systems. There’s nothing wrong with this.

      “if you are a web professional and a customer wants a CMS .. please don’t use a free open source CMS because lots of times, people don’t learn them and make shitty modules or core changes that make it impossible to update later on.”

      Also just a flat out falsehood. Find a module, test it out. Results unexpected? Check issue queue or move on. Its not that difficult. We haven’t had a single issue finding/creating modules and updating core. And in our case, we’ve modified the core to perform extensively better than it will out of the box (CDN integration, super caching, load balancing, memcache, APC and the like).

      Its only impossible if that is the limit of your ability. No offense. Just tired of the FUD when it comes to open source systems.

  10. josheat says:

    I have made many CMS systems for clients aged 25+ to 80.
    Not everyone can look at a massive joomla admin interface and know what to do, many people just give up there and look for another solution.

    Custom making a CMS is fun, you have full control over the website flow and after a few jobs you end up having a nice library of classes.
    Before you know it, a fully featured CMS that you have built yourself that you can start rolling out to each client with your branding on it! ;)

    • Palusko says:

      100% agree. Plus, in most cases, only some portions of the site need to be updated regularly, and it just is often easier for the customer to see a simple CMS interface for those sections, than to have a full-blown CMS for every detail of their page.

  11. anomynous says:

    How about a tutorial about security on a production level since every tutorial infallibly gets the ol’ “it’s not production ready, use a framework instead” comments?

  12. Moneyxl says:

    Thanks for this tutorial, I decided to join + last month and yes it has been a good investment, I mean $9 a month or whatever it is to be a plus member is basically less than what I pay for a gym session, the only thing is, I need to better organise my time to use actually learn some stuff that I’ve downloaded, great site, I’m happy I joined and would be joining for three months once my current monthly one’s up.

  13. Thank you all for your comments. I appreciate it :).

    For those wondering why a custom CMS, it’s because a custom CMS makes you the boss. The common CMS’s are too crazy and have unnecessary features like Joomla and Drupal (unless of course your website requires the tools it offers). And if you’re building a simple/regular website, sometimes even simple CMS’s like WordPress just won’t do it. With a custom CMS, you have the power to do whatever you want and add whatever functionality you need.

    For some it’s useful, for others it’s unnecessary. In the end, the point of the tutorial is to teach you the concept and how it’s made instead of whether or not it’s smart to make one.

  14. Kyle says:

    Looking forward to diving into this. I had recently started working on my own CMS for my future wife to use and for my own knowledge. This should be helpful.

    Also, are there any soon to be tutorials on LDAP? I have so many ideas for small businesses that would run perfectly if I could just get LDAP to work properly.

  15. Alex Stomp says:

    WOW! I’ve been waiting for this…I’m probably going to offer CMS creation eventually for my web design business. Too bad it’s a plus tutorial…

    Can’t wait to read it once I join, if I join…but I probably will eventually :)

  16. mamjed says:

    dude i dont see the screen cast. were is it, i downloaded the files.

  17. Jan says:

    Just thinking if it is good idea to create your own CMS and offer it to the clients from bussiness perspective.

    From my previous experiences I realise that having my own CMS it’s sometimes harder to offer to the client, because they want to have CMS which is well known for everyone, well documented, well supported (like Joomla! WordPress etc.), as your own CMS could be very difficult understand for someone who will take over client web service in the future.

    So what are your experiences? What do you prefer?

  18. Steve says:

    Does this tutorial cover a membership system by any chance? Or is it just editing pages? Thanks

  19. Paul du Long says:

    Not a member system, but a login system for 1 user ;)

  20. Michael says:

    Great.. Exactly what i was looking for since a while!

    Using CMS like Joomla is ok, but for some clients just too powerful

  21. John says:

    Thanks so much! I’ve been waiting for a new PLUS tutorial that featured something different for once. It’s nice to see some different subjects that have nothing to do with PSD to HTML or PSD to WordPress. Glad we’re switching it up some.

  22. Web010 says:

    Anybody wants me to send him money to moneybookers and he purchase a plus membership for me?

  23. Hasanga says:

    @Jeffrey:
    what? you are running out of ideas?

    I suggest you to take a look at http://psdtuts.uservoice.com/pages/nettuts_tutorial_suggestions

    hey Sunil! love this kinda tuts man! are you planing to have any thing in future under this topic?
    If so Please also consider about implementing a plugin API and modular.

    Cheeerrss!

  24. Jeff says:

    is anyone else having trouble viewing the screencast. I get to a certain point and it just kinda freezes? Wanted to know if it was just me.

    I tried downloading the FLV file too with no joy. Gutted lol.

  25. MrShish says:

    Here in Sweden, EPI Server seems to be the shizzle when it comes to CMSes. Do anyone of you know how it’s compared to EE, Drupal or any other Open Source CMSses?

  26. masterpsk says:

    Is anyone else having problems with membership? i joined this morning and Paypal already took my money, still i have no confirmation email from Tutsplus and I cant acces Plus content.

  27. Jez says:

    Just signed up for tutsplus as i was looking for a simple, non bloated CMS :)

    Watched the tutorial, then as I’m not the greatest coder, uploaded the files to my server, created the database and uploaded the .sql, changed the connection.php file to details used for my database….

    but it does not work. just getting the following html output in the browser, it aint conecting to the database….any ideas ??

    beta – a free web template by spyka webmaster

    beta
    spyka.net – you know you want to

  28. Jez says:

    ok reinstalled everything and its working fine :) so ignore my last comment

  29. Diego SA says:

    Ahhhhhh! Damn! There’s something I really need in this tutorial. AAAAHHHH! Don’t have plus.

    • Jeff says:

      It’s $9.99 a month, even if you subscribed for a month you’d get access to this, some excellent Shopping Cart tutorials and some other neat tutorials and if Photoshop is your bag there re LOADS in that area.

      $9.99, thats it.

  30. It’s interesting this tut was posted. A client of mine just asked for a custom CMS for their site and I need a refresher course.

    I’m glad I joined.

  31. Massbase says:

    thank you for this, i really need this, i might apply for a months worth of plus tutorials.

  32. Simon says:

    Well, why not vote for this suggestion:

    Tutorial about the template system called Smarty and its advanced features. It’s really difficult to find some interesting indeep tutorials about this engine so this would be unique !
    - Setup
    - How to use
    - features (loops, functions, etc.)
    - Good and bad uses
    - etc.
    Thanks !

    url: http://psdtuts.uservoice.com/pages/2997-nettuts-tutorial-suggestions/suggestions/225766-advanced-use-of-template-systems-smarty-
    I would be ready to pay for such tutorials !
    So let’s vote ;)

  33. Shame I don’t have plus, does anyone know of a good alternative to TinyMCE though? TinyMCE is great, just a shame its soo big!

  34. vinod says:

    Hi Tutsplus,

    I would like to join in tutsplus on an yearly subscription basis, unfortunatelly I don’t have credit card or paypal account, Could you please let me know is there any payment options available apart from those.

  35. RNR says:

    Thanks for the TUT. You’re very easy to understand and follow – much appreciated.

    I may be missing something, but is there a way to fast forward and rewind while watching the TUT PLUS screencasts? I like to review things a number of times while watching screencasts.

  36. Nice article. Good job.

  37. Art says:

    Ok I have a problem. I am trying to make a little script to add pages without having to go into the sql database. And i have a script that works but has problems. How would i combine the following sql statements into one?

    $sql = “INSERT INTO page (id, name, content) VALUES (‘$id’, ‘$name’, ‘$content’);”;
    $sql = “INSERT INTO nav (id, name, url, title) VALUES (‘$id’, ‘$name’, ‘$url’, ‘$title’);”;

  38. Dave says:

    Very nice!!! I think a tutorial about portfolio cms(portfolio manager) is also a good idea…

  39. Jez says:

    Uploading Images via Tiny MCE

    Spent hours trying different options and then found one that was almost straightforward:

    http://www.lunarvis.com/products/tinymcefilebrowserwithupload.php

  40. Gareth Hardy says:

    I’ve been looking for something like this for some time, thank you so much :)

    Hmmm now to have a go…

  41. Aliester says:

    Hey nice article it is.you are easy to understand this,It gives a new idea to me for custom cms.

  42. Keenan Payne says:

    Well you guys got me on this one. Time to sign up for Tuts Plus.

  43. Nate says:

    Wow. With all these Tuts+ tutorials I’ve learned some major web development. If I’m building WordPress themes, jQuery Plugins and Custom CMSes at 13, I will probably be a web master when I’m an adult.

  44. Mr Twiste says:

    Are the videos downloadlable ? If yes, what is the size of this one ?

  45. Mr Twister says:

    Are the videos downloadable?

  46. I have a problem when i’m trying to update the pages section:

    Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\website\update.php on line 10

    anyone can help me? i tried everything and nothing

    Thanks

  47. Mr Twister says:

    Are the videos downloadable or NOT >

  48. Mr Twister says:

    And wbat is the size of this one ?

  49. aks says:

    cannot this tutorial be accessed without joining tutplus lol?

  50. Manuel Corazzari says:

    im having a begginers problem to see the website and i get this message >>>

    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

Comment Page 1 of 21 2

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.