Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

error warning if similar data exist in db

Posted 16 Oct 2006 18:25:51
1
has voted
16 Oct 2006 18:25:51 ede edd posted:
hi

i’ve made a form where admin could register a subject to a student ,
but how do check or made sure that the admin don’t register the same subject twice to the same student . How to make a error warning for this case?

example :
subject_registerd
no | user_id | subject_code
1 0001 PrgC
2 0001 VB101
3 0070 PHP
4 0001 VB101

here user 0001 has double entry of subject code VB101 , how do i code to make sure this wont happen?



I’ve created 3 database :
subject_registerd
no | user_id | subject_code

student
no | user_id | user_name | user_login

subjects
no | subject_code | subject_title


I’m using list/menu to select subject to register (i used the insert new record function to insert subject code and the user_id into the subject_registerd dbase )

im using dmx and mysql

hope u could help

Replies

Replied 17 Oct 2006 06:33:24
17 Oct 2006 06:33:24 micah santos replied:
first thing foremost is to identify your "PRIMARY KEY", which is the user_id. by doing that, you were be able to determine the current subjects of an specific user as the admin enter his/her id number. the next time the admin will enter a new subject, just query the user_id first, then, locate the subject code into the database. if there's an existing record, then, do not allow the new selected subject to be add, and prompt admin.

with regards to a "NEW USER", which means there are no current subjects in the database, display a list of subjects using checkbox.

e.g.

math []
english [x]
science[x]
history[x]

SUBMIT

P.S.

i didn't provide you the code for this problem, because, honestly, what you really need is the coding structure.

Reply to this topic