Home >Backend Development >PHP Tutorial > 循环取值有关问题

循环取值有关问题

WBOY
WBOYOriginal
2016-06-13 13:08:591023browse

循环取值问题
页面

1
2
3



//从数据库取值后
while($re = mysql_fetch_array()){

如果我数据为1时,我想
1
变成
1


}

出来页面的结果就是
1
2
3



怎么能实现呢,谢谢了

------解决方案--------------------
这你就用jquery取div中的值,然后跟php获取的值比较,给个变量赋值class类就好了
------解决方案--------------------
$index = 0;
while($re = mysql_fetch_array()){
$index++;
if($index == $re['字段'])
$class = 'class="checkedBtn"';
echo '
1
';
}
Statement:
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
Previous article: php资料路径的操作 Next article: PHP 日期操作 总结