query("select * from ecmreceipts where id='8aa03944-fc72-26ec-8eb4-4b718085454e'"); while($r=$GLOBALS[db]->fetchByAssoc($w)){ $ww=$GLOBALS[db]->query("select * from ecmreceiptitems where ecmreceipt_id='".$r['id']."'"); while($rr=$GLOBALS[db]->fetchByAssoc($ww)){ $rrr=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select id from ecmreceiptitems where ecmreceipt_id='".$r['ecmreceipt_id']."' and ecmproduct_id='".$rr['ecmproduct_id']."'")); echo "update ecmreceiptitems set ecmreceiptitem_id='".$rrr['id']."' where id='".$rr['id']."';
"; } } ?>