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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2008
    Posts
    31
    Thanks
    6
    Thanked 0 Times in 0 Posts

    query and view data in the web, help me.

    At first im sorry about my bad English.So i have to code a site admin to edit products in my database.But i dont know how to code it.My ideas is that i will query data from my database and divide it into many lines in my web to edit.Every lines will have one check box for purpose of editing.When i check a check box can be chosen for editing, removing.but I am wondering whether check box can be used for one line with my data or not? it is similar to that we have a same 4room , we are all adminitors and at that time we can choose anytopic needing removing by check checkbox.

    Thanks in advance.!!!
    Last edited by crazyman; 08-01-2008 at 05:00 PM.

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    It is a bit hard to understand your post, but I will try as best I can! Hope we can be of help!

    First, you need to have some sort of security system in place, so not just everyone can get to this area and administrate your products and such. So make sure you have that.

    The common practice here is to do a query to grab the product's information and put it all into variables. So, for instance, you might grab the product_id, product_name, and product_category. Then, you could print out the product_id (probably don't need to edit it), you could use a text field for the product's name and make the value use the product_name variable, and the same for the product_category. It could be something like this:

    PHP Code:
    <?php
    $x 
    mysql_query("SELECT product_id, product_name, product_category FROM products");
    $y mysql_fetch_array($x);
    foreach (
    $y as $key => $value) {
       $
    $key $value;
    }
    ?>

    <form method="post" action="<?=$_SERVER['PHP_SELF']?>">

    <p>
    Product ID: <?=$product_id?>
    </p>

    <p>
    <input type="text" name="product_name" value="<?=$product_name?>" />
    </p>

    <p>
    <input type="text" name="product_category" value="<?=$product_category?>" />
    </p>

    <p>
    <input type="submit" name="submit" value="Submit" />
    </p>

    </form>
    That should get you started. Good luck!

  • Users who have thanked JohnDubya for this post:

    crazyman (08-02-2008)


  •  

    Posting Permissions

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