Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post

    Best way to make a Admin Panel

    I'm making someone a script and I've come to the point where I need to make them an admin panel for easy access. Basically, the script is a quiz site. I'm trying to figure out the best way to put an admin panel for it.

    I currently have my mysql set up as the table being named "camp1" "camp2" "camp3" or whatever. Each campaign is a different set of questions. In the table camp1 i have the following rows: Question, answer1, answer2, answer3, answer4

    In the admin panel, I'm trying to make it where the user can Add Questions (with answer set), Remove Questions (Delete the row, shouldn't be hard), and edit the question and answer set.

    What would be a good way to do this? Please keep in mind the user does need to select which campaign they want to edit, but that is easily done. Could this all be done in one page, or should it be multiple pages?

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    335
    Thanks
    2
    Thanked 49 Times in 48 Posts
    If you use AJAX, which can be implemented easily if you use the JQuery functions or slightly more lengthy if you use the 'pure' Javascript XMLHttpRequest way.

    There is no best way to make the Admin script. You can make just one script which has all the functions or multiple scripts. But with AJAX and Javascript, it can be one page to do it all. Add, delete, edit e.tc making doing the questions job smooth and .

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,688
    Thanks
    80
    Thanked 4,648 Times in 4,610 Posts
    I currently have my mysql set up as the table being named "camp1" "camp2" "camp3" or whatever. Each campaign is a different set of questions. In the table camp1 i have the following rows: Question, answer1, answer2, answer3, answer4
    Almost surely bad DB design. You should NEVER have multiple tables with identical structures and contents that differ only in who or what they belong to.

    You should have *ONE* table with questions for all campaigns. Use a single field in that table to designate which campaign each question is for.

    In the table camp1 i have the following rows: Question, answer1, answer2, answer3, answer4
    No. You have the "following columns" or, better, "following fields". One "row" (better called "record") holds one instance each of those fields.

    It's really a bad idea to talk about "rows" and "columns" in a database; it makes you think you are working with a spreadsheet, not a database. It's certainly not wrong to do so, but I think it's better to use "records" and "fields" to clearly distinguish a database table from a spreadsheet table. There *are* things you can do in spreadsheets that you can't do in databases and vice versa.

    The very fact that you have multiple tables named "camp1", "camp2", etc., kind of confirms that you are thinking of spreadsheets, not databases.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •