/    Sign up×
Community /Pin to ProfileBookmark

[HELP] Making Stock Calculation On PHP

Guys,

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..

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmAug 01.2014 — 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.
Copy linkTweet thisAlerts:
@KalobTaulienAug 01.2014 — Hi preloode,

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 [B]mysqli_*[/B] functions to connect to your database. Here's a basic sample PHP MySQL connection script:
[code=php]
$host = "localhost";
$user = "database_username";
$pass = "database_username_password";
$database = "database_name";

$con = mysqli_connect($host, $user, $pass, $database);
if(!$con) {
$msg = "Could not connect to the database. <br />";
$msg .= "Error Number: " . mysqli_connect_errno();
$msg .= "Error: " . mysqli_connect_error();
die($msg);
}[/code]

- 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).

- 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).

[HR][/HR]

Kalob from Footrr.com
×

Success!

Help @preloode spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...