Page 1 of 1

updating problem when contain same ID

Posted: Wed Jun 11, 2003 1:05 am
by valen53
i need to select out the people who take OT in the date like 6/6 until 10/6.
below is the code to display the people. So maybe people take OT in 6/6 and 8/6 . so will display 2 time in table. The problem is when i update the status of the people. i can't find out which people was updated. i was use " empid" as unique ID already, but in a query maybe contain a people got 2 record but different date. when only update one of the record, system cannot find out which record was updated.

Code: Select all

<td>'.$empid.'</td><td><div align="center"> 
 <select name="status&#1111;'.$empid.']"></select>
<td>'.$row&#1111;APPLY_DATE].' ~ '.$row&#1111;DATE_TO].'</td>

anyone can help me ? thank a lot......
?>

Posted: Wed Jun 11, 2003 4:58 am
by volka
hm, then your id isn't unique anymore, is it? ;)
you might combine empid and the dates to a unique key. You would have to transfer all of those values through your link.
$row[DATE_TO]
please read http://www.php.net/manual/en/language.t ... rray.donts

Posted: Thu Jun 12, 2003 9:52 pm
by valen53
thank a lot , actually i dunno can put 2 foreach together, tht y i dunno how to do..
thank ur URL

foreach ($_POST['status'] as $status) {
foreach ($status as $status1) {

Posted: Fri Jun 13, 2003 4:24 am
by volka
please explain in more detail.
I don't get the point of what you're asking.

Posted: Fri Jun 13, 2003 4:41 am
by valen53
Actually i solve the problem already.

Code i used :

Code: Select all

foreach ($_POST&#1111;'status'] as $status) &#123; 
foreach ($status as $status1) &#123;
the value:
name = "status[$emp_id][$apply_date]" -- the unique id

Posted: Fri Jun 13, 2003 4:48 am
by volka
i c ;)