I need to write a script in php which updates single field in mysql table count itemcode where itemcode is equalto "abcdef" first i have to count no of times one single value appears in the itemcode use it for a loop for(icnt=0, icnt<count, icnt=icnt+1) { update itemcode // fieldname where itemcode="abcdef" // field with value abcdef with 'ip'+icnt // to be replaced with a contstant 'ip" plus counter } I am not too good with programming but can someone please help me with it.... i need to do this on a running project