I'm having problem on duplication of data when updating in row of mysql.
I am changing bed of a user where I can get at table1 the field fname, which is the names of user. Then send to table2, then already get the fname using rfname='$fname'
, This is my html getting a pop up that get the list of room by $roommedical. Iwant To not duplicate the entry. or how can i delete first the past row value before updating it to other row., The value on roommedical is default the only i want to change is rfname.
<label class="selectDrop" >Check This For Room:</label>
<input class="selectDrop" type="checkbox" name="statmed" value="active" id="statmed" />
<label class="selectDrop11" >Medical Ward:</label>
<input class="selectDrop11" type=text id=medbed name=roommedical value="<?php echo $roommedical?>" placeholder="Select Medical Bed">
<!--BUTTON--><input class="selectDrop11" type="button" name="choice" onClick="selectValue('medbed')" value="Check">
And This is my submit form php
$roommedical = clean($_POST['roommedical']);
$statmed = clean($_POST['statmed']);
mysql_query("UPDATE room SET rfname='$fname',statmed='$statmed' Where roommedical='$roommedical'");
When updating the patient name is duplicating the the red box line is the example of duplicating of my entry This is the picture
Thank you. I am bad at this, I know. Please understand me.