<?php //continue 跳过当前循环,进行下一个 //break 终止当前循环 $db=new PDO("mysql:host=localhost;dbname=root","root","root"); $db->query("set names utf8"); $res=$db->query("select * from admin"); while($row=res->fetch()){ if($row['user'!='admin']){ //echo $row['user']; //此处输出字段非admin的用户 continue; } /* if($row['user']=='root'){ break; //如果字段账号是root就停止循环不再执行 }*/ echo $row['user']; //此处输出循环 } ?>