Simple PHP Website To View/Add/Delete Entries From Database

Discussion in 'Web Design and Development' started by kolax, Jun 28, 2012.

  1. kolax macrumors G3

    Joined:
    Mar 20, 2007
    #1
    I have a spreadsheet which has 4 columns. Instead of editing the spreadsheet (can be messy), I'd rather view the content on a PHP webpage that allows me to order by each column, as well as being able to add, edit and remove data.

    I'll be able to set up a MySQL database (need to export from the spreadsheet to the MySQL database).

    This just needs to be as simple as it gets. I've done a little PHP, but most of my experience has come from tinkering with a template, rather than writing from scratch.

    Any help would great!
     
  2. 1911 macrumors member

    Joined:
    Mar 11, 2008
    #2
    I had this same scenario a while back, I resolved it by simply doing a Google search. Found more results than I needed, there is a ton of code snippets available out on the net.
    Another option is to use a PhP code generator, not sure if there are any full featured freeware apps or not, SQL Maestro has a freeware version that you may want to look at.
    PhPMaker is an excellent app for generating PhP code against a MySQL database, a bit pricy but generates beautiful code.
     
  3. rixax macrumors member

    rixax

    Joined:
    Apr 15, 2012
    Location:
    Toronto
    #3
    I don't know if this will help but I used Navicat to upload exported File maker pro files (tried both tabbed and csv text files.) to our MYSQL server. I used Dadabik to install the php front end. I should be able to do this direct from FMP but I think I need to upgrade all my versions to 10 or better. These two apps work fine.

    http://www.arraymusic.com/Muslib
     
  4. Hansr macrumors 6502a

    Joined:
    Apr 1, 2007
    #4
  5. clemsonhomerun macrumors newbie

    Joined:
    Jul 11, 2009
    #5
    I would suggest looking into CRUD development (Create Read Update Delete). Theres lots of frameworks that you can basically install and they'll work right out of the box for this type of thing: codeigniter, cake, etc
     
  6. TonyK macrumors 6502a

    TonyK

    Joined:
    May 24, 2009
    #6
    If the site is publicly accessible I strongly suggest a authentication mechanism be employed so the general public cannot enter, update or delete your data.
     
  7. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #7
    Thanks for replies.

    So I have a bunch of forms like this:

    <input name="exampleA" type="text" id="exampleA" />
    <input name="exampleB" type="text" id="exampleB" />


    I want to post the values to "insert.php". So I have:

    <form action="insert.php method="post">
    </form>


    Tutorials I've found involves doing this:

    <form action="insert.php method="post">
    <input name="exampleA" type="text" id="exampleA" />
    <input name="exampleB" type="text" id="exampleB" />
    </form>


    However, the problem is that I have the forms in tables and added formatting/layout structuring to it. So what I'd rather do is have something like this that isn't wrapping the form fields containing the values and instead have the post method just wrapped around the submit button and reference the values from the other form fields:

    <form action="insert.php method="post">
    exampleA.value
    exampleB.value
    </form>


    Is this possible? How do I post values like that?
     
  8. Jamesbot macrumors member

    Joined:
    Jun 19, 2009
    #8
    you should be using css instead of tables.
     
  9. smirking macrumors 6502a

    Joined:
    Aug 31, 2003
    Location:
    Silicon Valley
    #9
    There's a very good MySQL table editor out there called PHPMyEdit. It doesn't look as slick as some of the other suggestions posted and it lacks a modern UI, but it's freeware and it's quite flexible. I use this whenever I need a no frills database table interface for back end control panels that are only seen by internal users of the sites I'm working on.

    http://www.phpmyedit.org/
     
  10. lucasgladding, Jul 11, 2012
    Last edited: Jul 11, 2012

    lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #10
    Not sure if this was sarcasm or not... In case it wasn't, this is tabular data, so tables are appropriate.

    UPDATE: Nevermind, I see what you're saying now. That said, I often prefer using tables for admin forms, and you could argue that the information is tabular (granted, only one dimension).

    To the original poster, there isn't a simple solution to what you're wanting to do. You need to create the forms and the database, then write the controller code (i.e. PHP) to tie the two together. You can't just set up a form and have it talk to the database. Ballparking the work involved in each step:
    creating the forms: 10%
    defining the database: 10%
    writing the PHP: 80%

    As clemsonhomerun mentioned, there are frameworks that can generate the necessary PHP to get the forms talking to the database, and most would even generate the forms from the database structure, but you need to learn how to use the frameworks first. I use symfony, but there is a significant learning curve to that and most other frameworks.

    Regarding the comment about wrapping the values, generally speaking you'll need to keep defining the input tags. Again, frameworks can assist with this, but they have their own learning curve, so you probably wouldn't come out ahead in the short term.
     
  11. smirking macrumors 6502a

    Joined:
    Aug 31, 2003
    Location:
    Silicon Valley
    #11
    Normally I'd be giving the same answer you just gave... that you can't template your way to everything and that there's never a substitute for putting in the sweaty work of real coding if you want something that works, but this guy just wants to be able to dump his spreadsheet into a MySQL table, sort, and edit it.

    If that's really all he wants this doesn't need to turn into a programming expedition.
     
  12. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #12
    I've made progress with this and have forms in a table with the submit button working, which posts the variables to a php page which then writes them to the database.

    Next stage is to add some validation to this.

    Thanks for pointers.
     
  13. JayFK macrumors newbie

    Joined:
    Jul 15, 2012
    #13

Share This Page