Question:
I need help with creating a database for multiple categories.?
bt8685
2007-04-07 18:28:48 UTC
Does anyone know the easiest way to create a new database using the following info? I have between 400-500 individual products each with individual details. I need to create some kind of table where I can click on the name of each product and have a table come up showing their information. I guess this would be like one huge file and then tabs for each individual product. Hope I explained this well enough, but I am stumped as to how to go about this. Thanks.
Five answers:
John S Wiggins
2007-04-07 18:37:36 UTC
The answer is a bit beyond the scope of this forum, but here's a quick explanation: You'd use Access for instance to create your database. You'd create a table and enter all the information on each product, with the product name in the first column. Subsequent colums can contain other information. Then, using a switchboard and drop down menu, you'd pick the product your interested in and by query, return the details in a form or report. The form can contain a back button or a button for another search, closing the form and opening a new drop down search form. Check out the Northwind example database that you can install with Access for a good example of this type of function.
Jim Maryland
2007-04-07 18:47:25 UTC
You don't really need that many tables to do this if I understand this properly. Each of your "products" are going to have similar fields but just different values.



Attributes:

PartNo - an internal part number that you would assign for tracking this item

MfgPartNo - an external part number from the manufacturer

ManufacturerID - an ID to relate to another table containing the manufacturer deails (you'll create a view to merge this info)

PartName

DetailDescription



Another table for the manufacturer:

ManufacturerID - to link to the above table

Name - Name of the manufacturer

Address

Phone

WebSite



You'll want to keep data separated as much as reasonable and then create views to merge the data for presentation. You could of course keep the data all in one table but then you'd have a lot of duplicate information (like if you have multiple products from a manufacturer you would have their details for every entry rather than linking back to one entry).



If this is for a work project, consider buying a book on database design. For a school project, I'm sure you could find additional details for this with a Google search on database design for a retailer.



For a product to use, you have several options:

MS Excel - won't be a "real database" but could do this if only one person needs to use the data.

MS Access - Not an ideal solution (not great for multiple users) but offers more forms and reporting than Excel.

MS SQL Server - Better choice but not free. Is a decent database product.

MySQL - Free open source DB product. Good choice but may take some effort by a somewhat technical person to set up.

Oracle Express Edition - Free version of Oracle (limited to 4GB of data but with only 500 records, you won't exceed that)

Oracle Standard Edition One - More space than the Express Edition but does cost per user.
chahn11
2007-04-07 18:40:32 UTC
You can do it with MS Excel using a "lookup" formula, but being that you have 400-500 different products, your database will be quite large and will take some time to create, but it can be done. Sounds to me that you have your own business, if that is the case, learn how to use Excel, it is amazing what it can do.........It is the only thing that MS ever did that is really good!!!!!!!
cwconline
2007-04-07 19:00:27 UTC
Hello! OK, if its for the internet see if you have mysql and phpmyadmin now if you do... do this



not dbname is your own db name



create database dbname;



once you do this we need to set and create a table in side of the database like so



create table products(

id int not null auto_increment primary key,

product_name varchar(30),

product_des varchar(255),

added datetime);



that would create it now just to insert data into your database



INSERT INTO products set

product_name = "PRODUCT NAME GOES HERE",

product_des = "Product Description Goes Here",

added = NOW();



ok that would do the insert of the data, now to get data maybe by clicking info just create a product page such as



product.php

and of course where your products are listed



now in the page where the products are listed you need to set the URL or LINK to where you send them to view the product in a type of GET tag such as...





Nike Shoes




That would of course put Nike Shoes on the Screen, now to get that pid that was sent in your product.php



you need to get the data like so



Now the reason we get pid is because it follows the question mark and is what is = the product name




$pname = $_GET['pid'];



?>



ok now we need to connect and set db values






$dbhost = "localhost"; //It usally is set to local host

$dbuser = "user"; // the user set to ur db

$dbpass = "pass"; // the user of the db pass

$dbname = "databasename"; of course is the databasename



// ok now to connect to the db



mysql_connect("$dbhost","$dbuser","$dbpass");



// now to select the db :-)



mysql_select_db("$dbname") or die("Could Not Connect");



// OK now to get the data



//First set the query



$query = "SELECT * FROM products where product_name =

'$pname'";



// Now to echo it OUT!!!



while( $info = mysql_fetch_array($query))

{

echo "
$info['product_name']

$info['product_des']";



//Thats baiscily it WHEW Longest answer EVER





?>
2007-04-07 18:32:44 UTC
use excel best thing to use


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...