Need to mention first that i'am a newbie in PHP/MySQL. I would like to hear from you, from your experience, what's the best way or approach to deal with a table rows such as tbl.users
for future development and compatibility with other features on web application ?
Currently, I have a tablename users
like shown below:
id catid firstname lastname username email password status image
14 21 Joe1 Doe joe1.doe jd@m.cc sha512ed 1 pic.jpg
15 17 Joe2 Doe joe2.doe jd@m.cc sha512ed 1 pic.jpg
18 22 Joe3 Doe joe3.doe jd@m.cc sha512ed 1 pic.jpg
33 20 Joe4 Doe joe4.doe jd@m.cc sha512ed 1 pic.jpg
Now when I'm done with users, I would like to create an basic e-commerce with products, and clients, etc... And here comes the question, how should i work it out without need to recreate a tablename clients
?
Would be it clever to add a new column to tbl.users
such as attributes
and store some attribute there to extend the functionality such as client = 1
or something like that ?
So it will become like this:
id username ... attributes
14 joe1.doe ... rememberme = 1, client = 1
15 joe2.doe ... rememberme = 1, client = 0
18 joe3.doe ... rememberme = 0, client = 0
33 joe4.doe ... rememberme = 1, client = 1
Meaning that user.id = 14, 33
will become clients, and will be displayed appropriately in e-commerce component
?
If it's ok, how should I store that attributes
information ? I guess the way I made it is not right.