View Full Version : query and view data in the web, help me.

08-01-2008, 05:58 PM
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.!!!

08-02-2008, 06:42 AM
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:

$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']?>">

Product ID: <?=$product_id?>

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

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

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


That should get you started. Good luck! :thumbsup: