时间:2021-07-01 10:21:17 帮助过:5人阅读
while($row =$rs->fetch_assoc()) { echo ""; echo " "; }" . $row['FirstName'] . " "; echo "" . $row['LastName'] . " "; echo "" . $row['Age'] . " "; echo "" . $row['HomeTown'] . " "; echo "" . $row['Job'] . " "; echo "
query($query); /* numeric array */ $row = $result->fetch_array(MYSQLI_NUM); printf ("%s (%s)\n", $row[0], $row[1]); /* associative array */ $row = $result->fetch_array(MYSQLI_ASSOC); printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]); /* associative and numeric array */ $row = $result->fetch_array(MYSQLI_BOTH); printf ("%s (%s)\n", $row[0], $row["CountryCode"]); /* free result set */ $result->close(); /* close connection */ $mysqli->close(); ?>
------解决方案--------------------
没有错误信息吗?
看样子是没有打开错误显示功能
------解决方案--------------------
那只能是你的关联字段没有和数据库中的对应上。
实在没办法,用预编译处理吧:
$sql = "SELECT mid,movName,movType,movStar,movImg,movPlay,director,producter FROM mov_film"; $stmt = $this->mysqli->prepare($sql); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($mid,$movName,$movType,$movStar,$movImg,$movPlay,$director,$producter); $rows = $stmt->affected_rows; if ($rows > 0){ $arrMovie = array(); while($stmt->fetch()){ //将文件名从路径中取出并转换为相对路径 $movImg = "../../images/".basename($movImg); //截取文件名 $arrStr = explode(".",basename($movPlay)); $movPlay = "../../videos/".$arrStr[0]; $arr = array( "mid" => $mid, "movName" => $movName, "movType" => $movType, "movStar" => $movStar, "movImg" => $movImg, "movPlay" => $movPlay, "director" => $director, "producter" => $producter ); array_push($arrMovie,$arr); } return $arrMovie; }