CodeIgniter Forums

Full Version: Need your suggestions on a project's "thinking".
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,
I'm currently creating a CI project and i'm really stuck on how to cope with a situation i face. So i thought the best way to solve it was to ask someone who's more advanced here.

The situation is the following: 
I have 3 tables with data: Users, Contact info and  Pets.
These are all joined.

There will be non-registered and registered users. 

The non-registered users will submit a form with some data on (e.g. email, name and phone number) and i want from my side:
1) To check if email exists in table #1 named "Users",
2) If exists get the user_id of the existing user,
3) pass this user_id, together with phone in table #2 Contact_info
4) then finally, passing the user_id + newly created contact info id + all the other form data to table #3 Users.

The thing is that i also have upload file function in my controller and this kinda confused me.

Any ideas on how can i make it work?! 

Thank you very much!
You need a unique PIN (at least 10 digit alpha-numeric value) for each user. It will be stored in the User table (#1).

It is not sufficient to match only the email address before writing information to the Contact_info table. Someone could submit a fictitious set of information if all they need is the email address. I would reject any NEW registration if it uses an email address which is already in your Contact_info table. Only one registration allowed for each email address.

Table #3 is probably some other name than "Users" because that is your name for table #1. Perhaps you meant "Pets" as the name for table #3?

This is how I would configure these three tables

Users
-id unique, auto-increment primary key
-PIN unique

Contact_Info
-user_id link pointing to Users:id
-name encrypted
-email encrypted

Pets
-user_id link pointing to Users:id
-pet_name