Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12750
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: login validation from 2 tables in same database |
| Date | 2014-02-03 12:47 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <lco35a$vog$1@dont-email.me> (permalink) |
| References | <JYudncI3ia_9xnLPnZ2dnUVZ_sOdnZ2d@giganews.com> |
On Mon, 03 Feb 2014 03:03:28 -0600, hujan wrote: > Hi, how to do one log in form but being use by 2 different > entities/tables in the same DB? Logging in to the website is usually handled at the php session level between the web server and the client browser. Logging in to the database usually happens once for each request, often involving an included file that contains the db password and which sits outside the webroot of the server. If you wish to access multiple tables in the same database, you only need to log in to the database once in the php request server that accesses the database. Just don't close the db connection until you've made all the db requests needed to erve the http request. > Also, each table have different number of columns. Below is my table > fields: > > user [id(PK), profile, name, gender, dob, contact, addr1, > email,username, password] > > student [reg_no(pk), s_name, s_gender, s_ic, s_dob, s_contact, s_email, > s_addr1, s_addr2, country, s_dept, s_post, username, password] Your data needs some normalisation. If a student is also a user you're storing a lot of duplicated data. Think along the following lines: Person: id, profile, name, gender, dob, contact, addr1, email, country User: id, username, pw Student: reg_no, id, dept, post A user is a person who also has data in the user table A student is a person who also has data in the student table A student user is a person who also has data in the user and student tables -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
login validation from 2 tables in same database hujan <zarinsung@hotmail.com> - 2014-02-03 03:03 -0600
Re: login validation from 2 tables in same database Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-03 12:47 +0000
Re: login validation from 2 tables in same database "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2014-02-03 13:18 +0000
Re: login validation from 2 tables in same database Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-03 23:13 +0000
csiph-web