我在while循環中有問題..我的問題在下面描述。Php while和for loop問題
$sql = mysql_query($query, $this->db);
if(mysql_num_rows($sql) > 0)
{
$result = array();
while($rlt = mysql_fetch_array($sql,MYSQL_ASSOC))
{
$theature = explode(",",$rlt['mw_movie_theature']);
//echo 'count'.count($theature).'<br/>'; print_r($theature);
for($i = 0; $i<count($theature); $i++)
{
$sqls = mysql_query("SELECT * FROM mw_theatres WHERE status = 1 AND id='".$theature[$i]."'", $this->db);
$rlts = array();
while($rlts = mysql_fetch_array($sqls,MYSQL_ASSOC))
{
$rlt['movie'] = $rlts;
}
}
$rlt['value'] = 'true';
$result[] = $rlt;
}
echo '<pre>';print_r($result);die;
$ theature變量具有2,3,4個值。但是$ rlt ['movie']的值只能給出最後4個id的結果。我魔杖2,3,4 id值。
你應當標註正確的地方CLASE回答或添加您自己的.. – Kamal