脚本宝典收集整理的这篇文章主要介绍了php代码重用.有没有更好的方法呢?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
function display_maker_success($link,$userid){ $status="closed"; $result="completed"; $sql = "select start,name From wuuk where tasker_id ='$userid' and status ='$status' and result ='$result' order by id desc LIMIT 6;"; $result = MysqL_query($sql,$link); $iSEMpty=MysqL_num_rows($result); If ($isempty ==0) { echo "No Record"; } else { echo "<table border=1>"; echo "<tr><th>Date & Time</th><th>Name</th><th>Status</th></tr>"; while ($row = MysqL_fetch_array($result,MysqL_NUM)) { echo "<tr><td>$row[0]</td><td>$row[1]</td><td>Completed</td></tr>"; }; echo "</table>"; }; }; function display_maker_fail ($link,$userid) { $status="closed"; $result="fail"; $sql = "select start,name from wuuk where tasker_id ='$userid' and status ='$status' and result ='$result' order by id desc LIMIT 1;"; $result = MysqL_query($sql,$link); $isempty=MysqL_num_rows($result); If($isempty ==0){ echo "No Record"; } else { echo "<table border=1>"; echo "<tr><th>Date & Time</th><th>Name</th><th>Status</th></tr>"; while ($row = MysqL_fetch_array($result,MysqL_NUM)) { echo "<tr><td>$row[0]</td><td>$row[1]</td><td>fail</td></tr>"; }; echo "</table>"; }; }; function display_maker_stat ($link,$userid,$reuslt,$limit) { $status="closed"; $result="fail"; $sql = "select start,MysqL_NUM)) { echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$result</td></tr>"; }; echo "</table>"; }; };
function display_maker_stat($link,$reuslt = 'fail',$limit) { $status = "closed"; $htML = ''; $sql = "select start,name from wuuk where tasker_id ='$userid' and status ='$status' and result ='$result' order by id desc LIMIT 1;"; $query = MysqL_query($sql,$link); if (MysqL_num_rows($query) != 0) { $html .= "<table border=1>"; $html .= "<tr><th>Date & Time</th><th>Name</th><th>Status</th></tr>"; while ($row = MysqL_fetch_array($query,MysqL_NUM)) { $html.= "<tr><td>$row[0]</td><td>$row[1]</td><td>$result</td></tr>"; } $html.= "</table>"; echo $html; } else { echo "No Record"; } }
阅读约OOP
以上是脚本宝典为你收集整理的php代码重用.有没有更好的方法呢?全部内容,希望文章能够帮你解决php代码重用.有没有更好的方法呢?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。