【发布时间】:2015-03-02 05:44:16
【问题描述】:
我得到了一个.php 文件,我想编写一个 for 循环,该循环遍历数据库条目并为每个条目填充一个 div。我是一个完全的 php 菜鸟,我在网上找到的每个 for 循环似乎都不适用于我拥有的代码。任何让我开始的帮助将不胜感激。
我的连接数据库的php代码如下:
<?php
require 'mysqliconnection.php';
require 'top_bottom_functions.php';
$id = $_GET['id'];
$stmt_get_details = mysqli_prepare($connect, "SELECT name, nickname, birth_day, birth_place, age, division, fighter_record, stance, height, reach, directory, biography, flag, record FROM fighters_details WHERE id=?");
if ($stmt_get_details) {
mysqli_stmt_bind_param($stmt_get_details, "s", $id);
mysqli_stmt_execute($stmt_get_details);
mysqli_stmt_bind_result($stmt_get_details, $name, $nickname, $birth_day, $birth_place, $age, $division, $fighter_record, $distance, $height, $reach, $directory, $biography, $flag, $record);
}
mysqli_stmt_fetch($stmt_get_details);
$height = html_entity_decode($height);
$reach = html_entity_decode($reach);
mysqli_stmt_close($stmt_get_details);
?>
谢谢!
【问题讨论】: