Home > Backend Development > PHP Tutorial > php数字循环,$a如何写

php数字循环,$a如何写

WBOY
Release: 2016-06-13 10:11:33
Original
1193 people have browsed it

php数字循环,$a怎么写。
php数字循环,$a怎么写。

 session_start();
 include("conn.php");?>
$sql=mysql_query("select * from love_loveitem where itemvalue='astro' or itemvalue='lunar' or itemvalue='blood'order by orders desc limit 0,7",$conn);
while ($row=mysql_fetch_array($sql))
  {
$str=$row[items];
$name=$row[itemname];
$strvalue=$row[itemvalue];
$arr=explode("|",$str);//分割数组
?>
*".$name.":

";}?>

这是全部源代码,$a怎么写。

最终能实现以下的效果显示,帮忙看一下












------解决方案--------------------
$a = 4;
while ($row=mysql_fetch_array($sql))
{
$str=$row[items];
$name=$row[itemname];
$strvalue=$row[itemvalue];
$arr=explode("|",$str);//分割数组
?>
*".$name.":

";
$a += $a == 4 ? 1 : -1;
}?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template