方法一:很简单,再查询一次就好了,代码如下
while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) {
$sql = "select * from 表A where userid={$row_Recordset1['user_id']} limit 1";
$query = mysql_query($sql);
$user = mysql_fetch_assoc( $query );
?>
<轿罩tr>
你这里是不能用do while的,结果都没返备遍历出来,不可能有值的
你用备激弊联合查询
$sql="select * from 表仿族A,表B where 表A.userid=表B.userid"铅漏;
$re=mysql_query($sql);
while($row=mysql_fetch_assoc($re)){
$class[]=$row;
};
一条sql语句就搞定了
联合查询:$sql = "乎知盯select a.name as name,b.mobile as mobile from a,b where a.userid=b.userid";
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res)) {
echo "
你把表A的数据查出来,然根据id update进去表B不就可以了么