-
Cats萌萌
sql:select a.value,a.data1,a.data2,a.period,b.name,b.main_url from 表2 a,表1 b wherea.period in (1,2,3) and a.name=nb_visits and a.idsite = b.idsite orderby a.value desc;代码:<td><div><?php echo $row['name']?></div></td><td><div><?php echo $row['main_url']?></div></td><td><div><?php if($row['period'] == 1){echo $row['value'];} ?></div></td> 当period=1的时候 输出value??<td><div><?php if($row['period'] == 2){echo $row['value'];}?></div></td>当period=2的时候 输出value??<td><div><?php if($row['period'] == 3){echo $row['value'];}?></div></td>当period=3的时候 输出value??
-
30秒到达战场
$sql = "select * form 表名 where name='nb_visits' and period in (1,2,3) order by value desc";$res = mysql_query($sql);while($result = mysql_fetch_array($res)){if($result['period'] == 1){echo '<td><div align="center">'.$row['value'].'</div></td>';}if($result['period'] == 2){echo '<td><div align="center">'.$row['value'].'</div></td>';}if($result['period'] == 3){echo '<td><div align="center">'.$row['value'].'</div></td>';}}
-
holdtom
<?php$period = $_GET['period'];$result = mysql_query("select * form 表名 where name='nb_visits' and period=" .$period. " order by value desc");while($row = mysql_fetch_array($result)){?><td><div align="center"><?php echo $row['value']?></div></td><?php } ?>大概这个意思,前面连接数据库代码没写,这是最基础中的基础了应该不用我教
-
幕布斯6054654
select * form 表名 where name='nb_visits' and period in (1,2,3) order by value desc或者select * form 表名 where name='nb_visits' and (period=1 or period=2 or period=3) order by value desc
-
交互式爱情
你指的 period 这个变量是一个数组,还是一个单独值?如果是数组:$period = array(1,2,3);$period_str = implode(',',$period);select * form 表名 where name='nb_visits' and period in (".$period_str.") order by value desc如果是一个单独的值$period = 1;select * form 表名 where name='nb_visits' and period=".$period." order by value desc