21,887
社区成员
发帖
与我相关
我的任务
分享
function callback($match){
global $id,$suppliesid;
if($match[1]==$id){
return $suppliesid.$match[2];
}else{
return $match[1].$match[2];
}
}
//更新fetchorder表
$res=$db->query("SELECT supplies,foid FROM {$tablepre}fetchorder");
while($row=$db->fetch_array($res)) {
$supplies= $row['supplies'];
$str=preg_replace_callback("/(\d+)(\(\d+\))/is",callback,$supplies);
if($str != $supplies) {
mysql_query("UPDATE {$tablepre}fetchorder SET supplies = '".$str."' WHERE foid = '".$row['foid']."'");
}
}