amaldasm11sterling Posted September 16, 2011 Share Posted September 16, 2011 this is the script for viewing the data in edit mode <tr> <td width="67" height="24"><select name="qualifi"> <option selected="selected">None</option> <?php $qry=mysql_query("select * from qualification"); while($obj=mysql_fetch_array($qry)) { ?> <option value="<?php echo $obj[0]; ?>"<?php if($obj[0]==$qualifi) echo("selected"); ?>><?php echo $obj[1]; ?></option> <?php } ?> </select> </td> <?php echo"<td width='301'><input name='board' type='text' size='50' value='$board'/></td>"; echo"<td width='60'><input name='start' type='text' size='10' value='$start'/></td>"; echo"<td width='60'><input name='end' type='text' size='10' value='$end'/></td>"; echo"<td width='60'><input name='percentage' type='text' size='10' value='$percentage'/></td> </tr>"; } ?> </table> and the update query is like //qualification if($_SESSION[empcode]!="") { if($_SESSION[qualifi]!="None") { mysql_query("update HRMEMPQUAL set EMPCODE='$_SESSION[empcode]',QUALCODE='$_SESSION[qualifi]',BOARD='$_SESSION[board]',FROMYEAR='$_SESSION[start]',TOYEAR='$_SESSION[end]',MARK_PERCENT='$_SESSION[percentage]' where EMPCODE='$_SESSION[empcode]'"); } } how can i save all the data correctly while any change is take place...their are 3 rows of data.only the last fled data is updated all the 3 rows Link to comment https://forums.phpfreaks.com/topic/247263-only-last-filed-is-updated-every-where/ Share on other sites More sharing options...
WebStyles Posted September 16, 2011 Share Posted September 16, 2011 all your $_SESSION variables are invalid, I'm surprised that's even doing anything... this: $_SESSION[empcode] should be: // if the array key name is called empcode $_SESSION['empcode'] or // if you're getting the array key name from a variable called $empcode $_SESSION[$empcode] * you need to fix ALL your $_SESSION variables Link to comment https://forums.phpfreaks.com/topic/247263-only-last-filed-is-updated-every-where/#findComment-1269868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.