Posted: Tue Apr 29, 2008 5:52 am Post subject: How do I validate a field with data from existing values
Hi, Im a beginning PHP/MySQL developer and I'm trying to figure out how to do something, any help would be awesome.
Basically if i enter a value into a table using INSERT INTO; how do make PHP know and alert me when that value is already somewhere else in the table.
what i need to do is this...
I have 2 tables, 'people' and 'times'
'people' has columns (id, firstname, lastname) ;
'times' has columns (tid, time_in, time_out) ;
I filled in the 'people' table manually from a handwritten roster.
the 'times' table is filled in as people clock in and out, the person's id is INSERTed into the 'tid' field.
the goal is to clock people in and clock them out, if they're id is not already in the 'people' table with their names, then dont add the id to the 'time.tid' field and echo an alert
i have an html table that displays id, firstname, lastname, time_in, time_out from the 'times' and 'people' tables and they are JOINed together.
i have a small form where you can enter in a person's id, time is auto populated, and it is $_POSTed to the 'times' table ;
when this thing works i'd love upload it as a small open source app, I'll definitely include the people that helped in the source code. Thanks! _________________ the following statement is true...
the above statement is false.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum