How can I create (or download) an MySQL Web Admin for users?

Discussion in 'PHP' started by Haitashi, May 30, 2007.

  1. #1
    I have users register on my page and everything is getting saved on a MySQL DB. Everything works fine but I want to provide users to be able to login into an "admin" section where they can go and update or delete their info.

    I've found a couple of scripts that automate the creation of this but they also create the web form (for registration) for me. The form I have is pretty custom so I don't need nor want a script that creates it for me.

    Any good (and easily customizable) scripts to share that can do this? I can also code it myself if I have a link to a good tutorial.

    Thanks!!
     
    Haitashi, May 30, 2007 IP
  2. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #2
    it's pretty simple really. just select and update queries to the database. learn to read/write from/to a database and you'll be well on your way.

    here's a basic example for selecting items from a database and outputtiing them to the screen:
    
    <?php
        $conn = mysql_connect("hostname","username","password") or die("could not connect to mysql server");;
                mysql_select_db("database") or die("could not select database");;
    
        $query = "select id, first_name, last_name, other_info from tbl1 where username='username' limit 1";
    
        $result = mysql_query($query) or die("could not execute query");
        while ( $row = mysql_fetch_array($result, MYSQL_ASSOC) )
        {
            echo $row['first_name']."<br />";
            echo $row['last_name']."<br />";
            echo $row['other_info']."<br />";
        }
    ?>    
    
    Code (markup):
    and a basic example for updating a row in a database:

    
    <?php
        $conn = mysql_connect("hostname","username","password") or die("could not open connection to mysql server");
                mysql_select_db("database");
    
        $query = "update user_info set first_name = 'boo radley' where id=1";
    
        if(mysql_query($query))
        {
            echo "database updated....";
        }
        else
        {
            echo "an error occured and the data was not updated";
        }
    ?>
    
    Code (markup):
     
    ansi, May 31, 2007 IP