Thor187,
you've done some php, hooked some forms up to the database, saving your info, etc.
To do what you want to do now you need to start looking at frameworks.
Not using a framework is fine for what you have done so far. To do this 'mini' ERP system that you want without a framework is going to result in a lot of lines of not the greatest code being written, frustration from debugging and pulling out your hair when you're wanting to add on something later on.
Have a look at
symphony (I've not used it but it's all the rage with the cool kids) and if that doesn't make sense then check out
Yii.
With both of them you will still be writing php but you'll be doing it 'better'.
Personally - I used cakephp a long time ago and found it very difficult to get into. I then switched to Yii and it clicked with me. I briefly tried symphony a bit back and it didn't make sense but a friend of mine understood it within an hour or 2 .. so each to their own.
Please don't hand code a system like this, there is almost No situation, Ever, where you will have to do that. If your boss says that you need to do it all yourself then it's time to look for a different company.
Frameworks help speed up development and keep your separation of concerns, all that stuff spoken about above by Spacerat and Beachless as they usually enforce the MVC model. They also take care of your database - syou you don't have to worry about interacting with your MySQL/Postgres/Oracle/innodb yourself, you create an instance of yourmodela dn save it, the framework worries about putting the data into the database correctly.
This is done something like (ALL this code is pseudo code and could be a combo of php and js ):
In your User Model file:
User = {
id: {type: auto-increment, primary: true},
username: {type: string, unique:true},
password: {type: string, min:6, max:8 },
email: {type: email, unique: true}
}
In your Controller file:
//create a new user
$user1 = new User({username: 'Thor', password:'187', email:'
[email protected]'});
//Or create a new user using inputs from a POSTed form
$user1 = new User({username: $_POST['username'], password:$_POST['password'], email:$_POST['email']});
Then you update the users email address and save the record to the database:
$user->email = '
[email protected]';
$user->save();
That's the kind of functionality that your framework should give you.
It should have hooks where you can do stuff like encrypt the password before saving it to the db:
In your User model file:
function before_user_save_hook($user) {
if(isset(user->password) {
$user->password = md5($user->password);
}
return $user;
}
Go read up about frameworks, they all work in a similar fashion these days.
Get some theory behind you and then the practice may start to make sense..
Also - frameworks have generally got a lot of plugins that have done most of the stuff you need - authentication, social plugins, etc.
Rather create a test app, load in the plugin and then step through their code than rewrite it all yourself.
If you want to create the ERP system in the next 20 days then there's no point in struggling with Oath authentication for 10 days..
Check:
http://phpframeworks.com/
http://codeigniter.com/
https://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#PHP
http://symfony.com/why-use-a-framework