views:

35

answers:

2

Hi everyone, my questions are about login, and changing already saved data.

(Q1) 'Till now I've only saved input in the tables of the database (registration steps), now I need to check if the input (login steps), are the same of my table in database, in fact I have 3 types of users, then I'll have to check 3 kind of tables. Then if the input data matches with one of those 3 tables I will redirect the user to his specific area.

I'm thinking about saved the submitted data $login=$_REQUEST['login']; and $password=$_REQUEST['password']; and compare with the login column in the database. Then if the login matches, I'll compare the password submitted with the one in the row, not in the column. But I don't know how to do this search and comparison,neither what to use. Then if both matches I'll redirect the user. Else I'll send an login error message. (this I know how to do)

(Q2) What if need to change an already saved user ? For example to change an email address. My changing user's data web page is exactly the same like the registration user web page. Can I load the already saved options and values of registration (table user for example). Then the user will change whatever he thinks it's necessary, and then when he submits the new information, they would not create a new row in my table, but just be overwritten the old information? How can I do this?

Sorry for any mistake in English, and Thanks for the attention.

A: 

Check this out. Then if that doesn't help a bit, take a look at this.

Babiker
A: 

in fact I have 3 types of users, then I'll have to check 3 kind of tables

From what you said it seems that you have 3 different database tables to handle your users, did i get this right ? I belive that there might be more that you can learn from it by starting with your database design and i could try to be more of help if you can input some samples of what you currently have in your database like fields and it is types and a sample of an input data from it.

Using mysql you have query for each different action for instance INSERT to add new data, UPDATE to change information, DELETE, etc...

So you could load the data in a form yes, and he could change it instead of adding a new entry to your table.

I would recommend you to use php session aswell as making good use of mysql_real_escape_string to prevent injection in your site.

Prix