[HELP] Making Stock Calculation On PHP
I need some help to make stock calculation on PHP. I want to make inventory software. There are amount of stock in each goods detail. Then when I make a transaction detail with input/ output transaction, they will auto calculate the current stock.
I have no idea to make it, so I don't have any script yet. I really appreciate for any help. Thank you..
If you "have no idea to (how) to make it", may I suggest you not do it then?
Really. Programming is all about taking a task that you have broken down into steps and then writing code to accomplish each of those steps, using error checking to ensure they succeed and then ending up with the correct outcome. If one doesn't know how something is done one needs to get expert advice on how it works so that one can then develop the workflow.
A short hint : it involves a db and some arithmetic and some intelligent data handling. Have fun and begin designing your plan.
PS - If you're posting here you should be using:
at the top of ALL php code while you develop it!
If you have no idea where to start you may want to look into learning PHP and MySQL (I teach the perfect beginners course, message me and I'll hook you up).
You said you have no idea where to start, so I'm going to suggest some easy steps that will help with the learning curve.
- First, download "wamp" or "lamp" (Windows|Linux Apache MySQl PHP) so you can start building PHP applications on your computer.
- Next, setup phpMyAdmin (or just MySQL); create a database and assign a user to it. Google will be your best friend at this point.
- Once your database is set up, use mysqli_* functions to connect to your database. Here's a basic sample PHP MySQL connection script:
- From there, you'll want to learn how to create columns inside of tables in your database and best practices for MySQL (indexing, unique's, unsigned int's, etc).
$host = "localhost";
$user = "database_username";
$pass = "database_username_password";
$database = "database_name";
$con = mysqli_connect($host, $user, $pass, $database);
$msg = "Could not connect to the database. <br />";
$msg .= "Error Number: " . mysqli_connect_errno();
$msg .= "Error: " . mysqli_connect_error();
- Then you'll be able to create PHP scripts that connect to, and query, your database. php.net has a fantastic documentation and I suggest looking up their document everytime you need to learn something new in PHP.
- Then create a user interface. You'll probably start with HTML forms (POST method > GET method) and whenever the form is submitted, you can escape your $_POST variables and query your database.
- MySQL allows math. To reduce inventory is as simple as "UPDATE table SET column1 = column1 - 1 WHERE item_id='$item_id' LIMIT 1"
^^ That will keep you busy for quite some time. And despite what others say, if you have no idea how to build it.. that's the perfect time to learn how (just don't go live with it because you'll always learn more that can make your application more secure, faster, etc).
Kalob from Footrr.com
Last edited by jedaisoul; 08-01-2014 at 04:10 PM.
Reason: Link removed-advertising. Please do not put it back.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)