通过ID用户API内部加入并显示数据

时间:2018-12-01 12:45:29

标签: php api

如何显示学生价值数据? 因此,对于父母来说,访问者只能从孩子那里看到有价值的数据。 请帮助

scheme

对于标题,我已将其放在conn.php文件中

<?php
require_once "conn.php";
$query = "SELECT student, name, payment FROM payment INNER JOIN parent ON payment. student_id = student. student_id WHERE student. parent_id = id login parent" ;
$sql = mysqli_query ($link,$query);
$ray = array();
while ($row = mysqli_fetch_array($sql)) {
  array_push($ray, array(
    "id" => $row['id'],
    "student_id" => $row['student_id'],
    "date" => $row['date'],
    "grade" => $row['grade']
  ));
}
echo json_encode($ray);
mysqli_close($link);

?>

function.php

<?php
function escape($data){
    global $link;
    return mysqli_real_escape_string($link, $data);
}


function username_check($username){
    global $link;
    $query = "SELECT * FROM parent WHERE username='$username'";
    $result = mysqli_query($link, $query);
    if(mysqli_num_rows($result) == 0 ) return true;
    else return false;
}


function email_check($email){
    global $link;
    $query = "SELECT * FROM parent WHERE email='$email'";
    $result = mysqli_query($link, $query);
    if(mysqli_num_rows($result) == 0 ) return true;
    else return false;
}
?>

我很困惑,因为我刚刚了解了这一点以及错误结果; D

1 个答案:

答案 0 :(得分:0)

我想您需要类似

c