在循环外先定义个$i
$i = 1;
while ($row = mysql_fetch_array($query)){
if ($i%3 != 0)
echo $row['field']." ";
else
echo $row['field']."<br>";
$i++;
}
$i = 1;
while ($row = mysql_fetch_array($query)){
if ($i%3 != 0)
echo $row['field']." ";
else
echo $row['field']."<br>";
$i++;
}
include_once "./manage/connect.php";
$query_s="select atid,atname,atparent from article_type where atparent='0'";
$i = 1;
while ($row = mysql_fetch_array($query)){
if ($i%3 != 0)
echo $row['field']." ";
else
echo $row['field']."<br>";
$i++;
} echo "
<table align='top' border='0' cellspacing='0' cellpadding='0' align='center'>
<tr>
<td class='a12b' > {$row_s[atname]}</td></tr>
</table>
";
}
?>这样写对不对 怎么不显示 错在哪里
<?php
include_once "./manage/connect.php";
$query_s="select atid,atname,atparent from article_type where atparent='0'";
$i = 1;
while ($row = mysql_fetch_array($query)){
if ($i%3 != 0)
echo $row['atname']." ";
else
echo $row['atname']."<br>";
$i++;
}
?>不显示
当然不会显示拉
include_once "./manage/connect.php";
$query_s="select atid,atname,atparent from article_type where atparent='0'";
$i = 1;
while ($row = mysql_fetch_array($query_s)){
if ($i%3 != 0)
echo $row['field']." ";
else
echo $row['field']."<br>";
$i++;
}
echo "
<table align='top' border='0' cellspacing='0' cellpadding='0' align='center'>
<tr>
<td class='a12b' >
<?php echo $row_s[atname]?>
</td>
</tr>
</table>
"; ?>