Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. PHP Admin Control Panel [modified]

PHP Admin Control Panel [modified]

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpphptoolsquestionworkspace
4 Posts 4 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neex1233
    wrote on last edited by
    #1

    I am trying to make a PHP admin control panel, and have it set up, but I have 2 problems. The first one is the control panel is not working. This is the code I am using: The error I get is this: Error: Duplicate entry '0' for key 1 How should I fix this? I have the entry form in the right way, so it's not that, and I know I have the login details right. My second problem is that I can't select the user that I would like to edit. How could I fix that? The table with the usernames and passwords is called users, and I have the login script setup so you don't need to worry about that. Thanks! ;) EDIT!: This script actually creates users, not edits them. How would I fix that?

    modified on Sunday, May 31, 2009 5:40 PM

    M J 2 Replies Last reply
    0
    • N neex1233

      I am trying to make a PHP admin control panel, and have it set up, but I have 2 problems. The first one is the control panel is not working. This is the code I am using: The error I get is this: Error: Duplicate entry '0' for key 1 How should I fix this? I have the entry form in the right way, so it's not that, and I know I have the login details right. My second problem is that I can't select the user that I would like to edit. How could I fix that? The table with the usernames and passwords is called users, and I have the login script setup so you don't need to worry about that. Thanks! ;) EDIT!: This script actually creates users, not edits them. How would I fix that?

      modified on Sunday, May 31, 2009 5:40 PM

      M Offline
      M Offline
      Marc Firth
      wrote on last edited by
      #2

      I think the problem is you are trying to create the same row in the table twice. Create an "id" field set to auto_increment as your primary key. Then you can pass it a NULL value. Also, I'm not sure about your post code in the SQL. Try: $password = $_POST['password']; $userlevel = $_POST['userlevel']; $sql="INSERT INTO users (id, password, userlevel) VALUES (NULL, '$password','$userlevel')";

      Neonlight

      1 Reply Last reply
      0
      • N neex1233

        I am trying to make a PHP admin control panel, and have it set up, but I have 2 problems. The first one is the control panel is not working. This is the code I am using: The error I get is this: Error: Duplicate entry '0' for key 1 How should I fix this? I have the entry form in the right way, so it's not that, and I know I have the login details right. My second problem is that I can't select the user that I would like to edit. How could I fix that? The table with the usernames and passwords is called users, and I have the login script setup so you don't need to worry about that. Thanks! ;) EDIT!: This script actually creates users, not edits them. How would I fix that?

        modified on Sunday, May 31, 2009 5:40 PM

        J Offline
        J Offline
        Java John
        wrote on last edited by
        #3

        Hi neex1223, With regard to the second problem, you need to use the MySQL set command. Something along the lines of (not syntatically correct) where id = thisId, set password = new password. I emphasise - that's not MySQL code, but it's the right structure.

        S 1 Reply Last reply
        0
        • J Java John

          Hi neex1223, With regard to the second problem, you need to use the MySQL set command. Something along the lines of (not syntatically correct) where id = thisId, set password = new password. I emphasise - that's not MySQL code, but it's the right structure.

          S Offline
          S Offline
          Syed M Hussain
          wrote on last edited by
          #4

          UPDATE USERS SET USERNAME ='John', PASSWORD='newpass' WHERE ID= '1'

          www.cy2online.net

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups