第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

PHP 通過(guò)單擊查看按鈕查看單個(gè)記錄中的數(shù)據(jù)

PHP 通過(guò)單擊查看按鈕查看單個(gè)記錄中的數(shù)據(jù)

PHP
瀟湘沐 2021-07-01 05:00:02
我有兩頁(yè)students_list.php 和students_profile.php在students_list.php 上,我有一個(gè)表格顯示所有學(xué)生的所有記錄和VIEW 按鈕,單擊該按鈕時(shí)應(yīng)打開(kāi)students_profile.php 頁(yè)面并從基于std_id 選擇的單個(gè)記錄中獲取所有數(shù)據(jù)更新:所以現(xiàn)在當(dāng)我點(diǎn)擊 VIEW 按鈕時(shí)我得到了 id http://localhost/sms/student_profiles.php?std_id=3但我仍然沒(méi)有從這個(gè)選擇的記錄中檢索數(shù)據(jù)這是students_list.php的代碼<?phprequire_once 'include/database/connect.php';try {    $pdo = new PDO("mysql:host=$host_db;dbname=$name_db", $user_db, $pass_db);                                     $sql = 'SELECT * FROM students';    $q = $pdo->query($sql);    $q->setFetchMode(PDO::FETCH_ASSOC);    } catch (PDOException $e) {    die("Could not connect to the database $name_db :" . $e->getMessage());    }?><table id="data-table-default" class="table">    <thead>    <tr>    <th width="1%">#</th>    <th width="1%" data-orderable="false"></th>    <th>Name & Surname</th>    <th>Gender</th>    <th>Faculty</th>    <th>Semester</th>    <th>Mobile</th>    <th></th>    </tr></thead><tbody>    <?php while ($row = $q->fetch()): ?>    <tr class="odd gradeX">    <td width="1%" class="f-s-600 text-inverse"><?php echo ($row['std_id']) ?></td>    <td width="1%" class="with-img"><?php echo ($row['std_status']) ?></td>    <td><?php echo ($row['std_name']) ?></td>    <td><?php echo ($row['std_gender']) ?></td>    <td><?php echo ($row['std_faculty']) ?></td>    <td><?php echo ($row['std_semester']) ?></td>    <td><?php echo ($row['std_mobile']) ?></td>    <td align="right">    <a href="student_profiles.php?std_id=<?php echo $row['std_id']; ?>" class="btn btn-warning btn-xs"><i class="fas fa-eye"></i> View</a>    </td>    </tr>    <?php endwhile; ?>    </tbody></table>下面是 student_profile.php<?phprequire_once('include/database/sharepoint.php');if(isset($_GET) & !empty($_GET)){    $std_id = $_GET['std_id'];    $sql = "SELECT * FROM `students` WHERE std_id=$std_id";    $res = mysqli_query($connection, $sql);}
查看完整描述

1 回答

?
瀟瀟雨雨

TA貢獻(xiàn)1833條經(jīng)驗(yàn) 獲得超4個(gè)贊

您不會(huì)從查詢中獲取數(shù)據(jù)。所以 $row 永遠(yuǎn)不會(huì)包含你期望的數(shù)組:


$row = mysqli_fetch_assoc($res); //this will populate $row

在您的代碼中:


<?php

require_once('include/database/sharepoint.php');

if(isset($_GET) & !empty($_GET)){

    $std_id = $_GET['std_id'];

    $sql = "SELECT * FROM `students` WHERE std_id=$std_id";

    $res = mysqli_query($connection, $sql);

    $row = mysqli_fetch_assoc($res);

}

?>


查看完整回答
反對(duì) 回復(fù) 2021-07-02
  • 1 回答
  • 0 關(guān)注
  • 265 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)