Home >Backend Development >PHP Tutorial >请全能大神解答,此功能用PHP如何写?JSP代码已有,求翻译或者思路!路过请看看

请全能大神解答,此功能用PHP如何写?JSP代码已有,求翻译或者思路!路过请看看

WBOY
WBOYOriginal
2016-06-13 12:26:291047browse

请全能大神解答,此功能用PHP怎么写?JSP代码已有,求翻译或者思路!路过请看看!

本帖最后由 bluesjunior 于 2015-10-25 01:42:55 编辑 就是判断mysql的内容,在HTML上控制输出的颜色,具体请看下面:

链接:http://zhidao.baidu.com/link?url=rd4D37D5SxFe8fiQiJjEToUtziRhaQmYlo9QckfgBbgTHO8kXnchNhHh66N1gr7wFVdAa_Jyh-tvZCrvyUC5hq

这个需求百度上已有解答,但是是用PHP写的,有哪位高手能翻译成PHP么?或者有自己的思路?

------解决思路----------------------
<?php<br />$conn = mysql_connect('localhost', 'root', '');<br />mysql_select_db('test', $conn);<br />$sql="select * from test";<br />$r = mysql_query($sql);<br />?><br />  <table><tr bgcolor=green><th>id</th><th>name</th><th>ifpass</th></tr><br /><br />  <?php<br /><br />  while($rs = mysql_fetch_assoc($r))<br />  {<br /><br />   if($rs["ifpass"] == "y")<br /><br />   {<br /><br />    echo ("<tr bgcolor=blue>");<br /><br />   }else{<br /><br />    echo ("<tr bgcolor=red>");<br /><br />   }<br /><br />?><br /><br />   <td> <?php echo $rs["id"];?> </td><br /><br />   <td> <?php echo $rs["name"];?> </td><br /><br />   <td> <?php echo $rs["ifpass"];?> </td><br /><br />   </tr><br /><br />   <?php<br /><br />  }<br /><br />echo ("</table>");<br />?>
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:Url几个惯用的函数