我试图做一个模态候选人配置文件,但我的SQL数据不显示。请帮助我,我一直试图解决这个问题,但我真的没有线索。我试图寻找方法来解决这个问题,但没有一个工作。我希望有人能帮助我,谢谢。
printscreen of the result I have
- 这是我的代码 *
<!--button-->
<button data-bs-toggle="modal" data-bs-target="#profileModal" class="btn btn-primary" data-id="<?php echo $row['candidateID']?>">See profile</button>
<!--button-->
<!--Modal Profile -->
<div class="modal fade" id="profileModal">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header header-color text-white">
<?php
include ('../dbconn.php');
if(isset($_GET['id'])) {
$id = $_GET['id'];
$sql = "SELECT * FROM clg_candidates WHERE candidateID=$id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_array()){
?>
<h4 class="modal-title"><?php echo $row['name']?>'s Profile</h4>
<img src="ACLCLOGO/sclogo2.png" class="sclogo_profile" alt="School Logo">
</div>
<!-- Modal body START-->
<div class="modal-body">
<img class="card-img-top modal-img " src="picture/<?php echo $row['picture']?>" alt="candidate image" style="width: 300px;">
<br>
<h4><strong><b><?php echo $row['position']?></b></strong></h4>
<br>
<div class="content-text">
<div class="text-profile">
<strong>Name:</strong> <?php echo $row['name']?><br>
<strong>Party List:</strong> <?php echo $row['partyList']?><br>
<strong>Year/Grade & Course/Strand:</strong> <?php echo $row['yearLvl']?> - <?php echo $row['course']?><br>
<strong>Platform:</strong> <?php echo $row['platform']?>
</div>
</div>
<?php
}
}
$conn->close();
}
?>
</div>
<!-- Modal body END-->
<!-- Modal footer START-->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
</div>
<!-- Modal footer END-->
</div>
</div>
</div>
<!-- Modal Profile END -->
1条答案
按热度按时间dwbf0jvd1#
试试这个代码。