21,886
社区成员
发帖
与我相关
我的任务
分享
function queryUserReport ( $userid ) {
$resUserReportList = "" ;
$queryUserReport = "Select reportId, userid, reportCheckId, email, createtime, constitutiontype From userreport Where userid = '".$userid."' " ;
//echo "query:".$queryConstiutContent."<br>";
$resUserReportList = $this->user_db->querySQL ( $queryUserReport ) ;
if ($resUserReportList){
$resUserReportList = $this->user_db->get_Array($resUserReportList);
//print_r($resConstiutContent);
return $resUserReportList ;
} else {
return $this->user_db->print_last_error(TRUE);
}
$this->user_db->Close() ;
}
function querySQL($sql){
$this->last_query=$sql;
$result=mysql_query($sql);
if (!$result){
$this->last_error=mysql_error();
return FALSE;
}else {
$this->row_count=mysql_num_rows($result);
return $result;
}
}
function get_Array($result){
if (!$result){
$this->last_error="Invalid resource identifier passed to get_Array() function.";
return FALSE;
}else {
$row=mysql_fetch_array($result);
if ($row==FALSE){
$this->last_error=mysql_error();
return FALSE;
}else {
return $row;
}
}
}
Array
(
[0] => 3
[reportId] => 3
[1] => 414
[userid] => 414
[2] => 201209021468
[reportCheckId] => 201209021468
[3] =>
[email] =>
[4] => 2012-02-09 11:30:54
[createtime] => 2012-02-09 11:30:54
[5] => 1
[constitutiontype] => 1
)
//获取数据
$arrayUserReportList = $dbConstituModel->queryUserReport($_SESSION['userid']);
while ( $arrayUserReportList = $arrayUserReportList ){
echo "<tr>";
echo "<td>".$arrayUserReportList['reportId']." </td>";
echo "<td>".$arrayUserReportList['createtime']." </td>";
echo "<td><a href=\"/constest/constitutionreport/myreport_".$arrayUserReportList['reportCheckId'].".html\" target=\"_blcnk\">查看报告</a> </td>";
echo "</tr>";
}
Array
(
[0] => 3
[reportId] => 3
[1] => 414
[userid] => 414
[2] => 201209021468
[reportCheckId] => 201209021468
[3] =>
[email] =>
[4] => 2012-02-09 11:30:54
[createtime] => 2012-02-09 11:30:54
[5] => 1
[constitutiontype] => 1
)
<?
if ( isset($arrayUserReportList) && !empty($arrayUserReportList) ) {
//for($i=0; $i<count($arrayUserReportList); $i++){
//for($i=0; $i<2; $i++){
//foreach( $arrayUserReportList as $key=>$value ) {
while ( $arrayUserReportList = $arrayUserReportList ){
echo "<tr>";
echo "<td>".$arrayUserReportList['reportId']." </td>";
echo "<td>".$arrayUserReportList['createtime']." </td>";
echo "<td><a href=\"/constest/constitutionreport/myreport_".$arrayUserReportList['reportCheckId'].".html\" target=\"_blcnk\">查看报告</a> </td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan=\"3\">您还没有体质测评报告!</td></tr>";
}
?>