Question:
database in sales website.?
nguyen t
2011-06-18 04:43:56 UTC
now I'm making a single sale website.In database you have table eMember, when customers want to buy must be logged into their account .but must have an administrator account to add, delete product or management account member.Then what it is you have to create a new table (for example Admini) separate from the other table, can only be imported from a database or table to make it general Member in some way? I new to web programming ,plese help me..
Three answers:
anonymous
2011-06-18 05:31:37 UTC
Use a table for people generally. Does not matter what it is called. So eMember will do, and store the user login name and an encrypted copy of the password in it, and give it an int() auto_increment primary key. Then an address table with further information. Again give it an int() primary key, and use the id from the eMember table as the ID. You cn then use a table for security levels, a user having a level of 1, admin a higher number. This way you can set different admin levels. That way one admin might be able to edit site details, another only add or remove products, or set prices.

So you need to create :

eMember :

id int() primary key auto_increment

member_login varchar() unique key

member_password varcha()

//I never call the password field password as a security improvement, maybe member_word or //similar

eAddress :

id int() primary key

address_1

address_2

//Any more like postal codes etc.

eDetails :

id int() primary key

detail_1

detail_2

//could include this in the address table, but makes it easier to add/remove fields as you build

//also makes it possible to only access less data at points you don't need the address details

mem_security_levels

int() primary key

level int()

//Again different names for tables might use mem_lev to hide the real purpose

//Each primary key will be the related user id

//Then tables for products, product_details etc in similar layout to the user tables.

//This way anyone can be a member or admin, or both

//Then a table of links to other pages so you might have a page called admin, the button or link //calling it would be called full_admin or similar and only allow the php to display that to anyone with //the main admin security level, and another table blocking pages the same way.

Table :

pages :

id int() primary key auto_increment

table_name varchar() unique key

//This can carry the page name without the .php and can then be used to match the user with their //permissions.

page_levels :

id int()

level int()

//primary key of this table to be both keys to prevent duplicate entries.

//Contains the list of page ids against the levels allowed to access them

//So a table can have all or any combination of levels permitted, or just one, the main admin

//If you name the link display the same as the page, you can get php to only show the link/button //when the person has that permission and then build the path to the page by adding the .php to the //name.

This is a lot to think about. And it takes a lot of work to set up and combine. But then you can automate almost anything on a page. So links and buttons could also have a table for the displayed text so you might have a button called account, and could vary the text from the admin login to be "Your Acount" , "Account Details", "Your details" just by updating the field from a form. I have a lot of sites doing this, plus tables listing backgrounds and images by name so you can change an image the same way, maybe display a different image at intervals just by looking up the next one you want.

And if you get international visitors, you could use different displayed text for the buttons according to the language. All controlled by adding tables. And if the layout of all the finer detail tables is the same you can write one function to look up the data and call it from any page on the site when you need it. Including multiple times on the same page. Just include() the functions.php page in index.php, then include the pages required in index.php as they are selected by button and the site only ever shows index.php. Hides all the magic and your code. And edit the function, all the pages change at once.
anonymous
2016-10-04 04:12:10 UTC
initiate out with the e book "Ajax in action" via Manning guides. you could pass an prolonged, long, good way in any course with the (a) programming language you prefer to apply, the (b) determination of database engine (c) and utilizing some thing like Json -- a javascript library that responds to Hypertext Preprocessor variety of calls and generates an HTML internet site. you would be able to additionally acquire the NetBeans new 6.5 EE version and do some of their tutorials. the completed java 6.5EE incudes a server, 2 databases and the java language with an outstanding sort of extra API. each and every of the above is: in case you prefer to try this from scratch. Google internet strategies can provide a gaggle of widgets. So does eBay and so does Amazon. Server-area is a jungle and you need to first do a sprint examine. i could wander right down to a variety of bookstores with a working laptop or workstation shelf and a espresso shop and income a sprint vocabulary. The database edge of that's no longer something. Getting significant queries from that database is the concern.
?
2011-06-18 04:59:52 UTC
No you need to have separate Account of administrator(in the table) to manage the other members.

It also depends on how many admin accounts you want to have. If you want just single administrator then just add extra field in your table- account_type and store admin there.

If more than one admin accounts are there make separate table admins and store their information there.

Hope that helps.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...