A couple questions

Ok, to preface myself, I’m a chef that does some programming as a hobby. No training in php in the slightest. I’ve been able to do what I’ve needed so far, but I would like some help with some questions I’ve come up with. The owner of the restaurant I work at wants me to create some pages to inventory tracking between stories, order pricing, etc.

1.)When do you decide to create a new database over using a new table? As of right now, I’ve been using just one database and adding whatever tables I need

2.)The one piece of ability for the project I’m about ready to start, is to be able to add new items to a table, which I’ve been able to do. But I’m going to need to call up all the tables rows, which I’ll do on the fly. It needs to handle 2 variables, quantity and price, that change consistently, and two that are static, location and type. Basically I was thinking of using two tables to do this. One listing the item, and the two constants, and also having an auto-id. The second would have row column names based on the auto-id of the first, something like 1Q 1P, 2Q 2P…100Q 100P, etc.Will that actually work for what I want/need to do?

3.)Hopefully final question for now. For the function I need to do, I want to use a while statement. Example in dumbed English

$insert ="";
$value = “”;
$i =1;
while(row = array(search)){
$insert = $insert + $i +"q, "
$iq = $i +“q”;
$ic = $i +“c”;
$insert = $insert + $i +"q, "+ $i +"c, “;
$value = $value + $_POST[$iq] +”, "+$_POST[$ic] + ", ";
$i++;
}
Truncate ", " off of $iq and $ic
Insert into tablename ($insert) Values ($value);

Would that theoretically work for what I Need to do

Welcome to the forum…

First you were not clear on your data. If you have set items that do not change, they would be your base data.
If you have items attached to these that are variable one table would do well for you. A simple table with all of this data would be all you need, something like this:

Table: Let’s call it “Inventory”

Name of fields for items inside the table: Name, Type, Location, Quantity, Price

This should be all you need for the project you mentioned. First, you would need to create a form that allows you to enter, delete and alter data in these fields. Then, a second form that would be used for
your inventory process. This process would be for UPDATING your inventory info. Perhaps you would also want to create a form to report your results.

Online there are many many examples of inventory programs. Most are free.

Here are some samples for you to checkout:
http://www.findmysoft.net/scripts/mysql_inventory_php_script/
http://asset-tracker.sourceforge.net/
http://www.sourcecodester.com/visual-basic/inventory-system-v1075.html

All of these look interesting for your project. Most are free and have downloadable source code. This would save you a lot of time. I looked at the last one listed and it’s layout is nice. But, look at them all…

Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service