Advertisement:

Author Topic: Sql table  (Read 1915 times)

Offline avinash90

  • Newbie
  • *
  • Posts: 3
Sql table
« on: March 19, 2012, 11:36:55 PM »
Respected gurus,
   I want to develop corporate recruitment system and create 7 table i.e user_registration,dept.,sub_dept,multiple_question,desc_question_ans,mul_ans.
My objective,
1. Dispyaed questions are dynamically but select from static question
2. store the user input.
3. sending email and sms to the user.

The tables are
1.User_registration(a_id , A_name, F_name,DOB, gender,Tadd,Padd,Tel_no, Cellno,    emailid,Aemailid,Tech, Qualification, Exp,reference,D_id, Exam_date,Result_mul,Result_desc,No_of_text,Qualify);
2.Org_user_master(u_id,login,pass,E_id,E_name,u_date,User_type,Branch);
3.Master_dept(D_id ,D_name);
4.Subdept(Sd_id ,Sd_name ,D_id);
5. Mul_question(Q_id , D_id , Q_text , Sd_id);
6.Mul_opption(U_id,Q_id , opption,Answer, Q_seq_no);
7.Desc_question_answer(Dq_id,D_id,Sd_id,Q_text, A_path, Status)

please guide me to how to solve this and what wrong with me.
« Last Edit: March 20, 2012, 10:42:08 AM by avinash90 »

Offline CapadY

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,128
  • Gender: Male
Re: Sql table
« Reply #1 on: March 20, 2012, 03:21:12 AM »
and you want to do this with an SMF forum or an extension on it ?
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

Offline Ricky.

  • Customizer
  • SMF Hero
  • *
  • Posts: 4,026
    • Indian Linux Forums
Re: Sql table
« Reply #2 on: March 20, 2012, 04:00:27 AM »
Basically you are looking for a database design , whatever limited information you gave, I can see that you can have following : (taking in account your major need ie question / answer part)

1. A user info table : To record user specific details / Registration details
2. A question / Answer table , where you will store your questions with answer to them.
3. A user input table where you will store answers given by user. There can be various way, however simplest is to
--------------------------------------------
User   ID  | Question ID  | Answer
--------------------------------------------
    4          |   29                | 2
--------------------------------------------
So, you can store, User with ID 4 gave answer 2 for question number 29 .
Assuming your questions are multiple choice questions.

I hope that helps, don't consider it final layout, as it can drastically change as per your actual need.

Offline avinash90

  • Newbie
  • *
  • Posts: 3
Re: Sql table
« Reply #3 on: March 20, 2012, 10:04:45 AM »
I prepare the table
1.User_registration(a_id , A_name, F_name,DOB, gender,Tadd,Padd,Tel_no, Cellno,    emailid,Aemailid,Tech, Qualification, Exp,reference,D_id, Exam_date,Result_mul,Result_desc,No_of_text,Qualify);

2.Org_user_master(u_id,login,pass,E_id,E_name,u_date,User_type,Branch);

3.Master_dept(D_id ,D_name);

4.Subdept(Sd_id ,Sd_name ,D_id);

5. Mul_question(Q_id , D_id , Q_text , Sd_id);

6.Mul_opption(U_id,Q_id , opption,Answer, Q_seq_no);

7.Desc_question_answer(Dq_id,D_id,Sd_id,Q_text, A_path, Status)


i want to question are displayed in dynamically select from the static question.

Offline Ricky.

  • Customizer
  • SMF Hero
  • *
  • Posts: 4,026
    • Indian Linux Forums
Re: Sql table
« Reply #4 on: March 20, 2012, 10:45:29 AM »
You can actually select random question easily from your db and show it .. easiest way is :
Code: [Select]
SELECT * FROM `table` ORDER BY RAND() LIMIT 1;
However, if your db is small, its fine, but if its not small then above query is problem : then you can actually find rand using mt_rand() in php then fetch that ID from db.
eg would be :
Quote
$range = mysql_query( " SELECT MAX(`id`) AS max_id , MIN(`id`) AS min_id FROM `table` ");
$range_row = mysql_fetch_object( $range);
$random_id = mt_rand( $range_row->min_id , $range_row->max_id );
$result = mysql_query( " SELECT * FROM `table` WHERE `id` >= $random_id LIMIT 0,1 ");
However, it can be further tweaked.. its not the tested code but should give you idea.

Offline avinash90

  • Newbie
  • *
  • Posts: 3
Re: Sql table
« Reply #5 on: March 20, 2012, 01:48:49 PM »
Thank u sir .
please check my table.what we can add this table for more valueable .