我使用$_SESSION[''];
在用户登录后获取值。此数据来自users
表。
然后我通过执行查询并在用户API = $ API
时为每个值分配var来尝试SELECT *
FROM roster
表
error_reporting(E_ALL);
include ('database_connection.php');
$DOCSIGNEDBYIP = $_SERVER['REMOTE_ADDR'];
$API = $_SESSION['API'];
$FirstName = $_SESSION['firstname'];
$LastName = $_SESSION['lastname'];
$Email = $_SESSION['email'];
$ExecutionDate = date();
$query = "SELECT * FROM roster WHERE API='$API'";
$result = mysqli_query($dbc, $query);
$address = $result['address'];
database_connection.php
$dbc = @mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD,
DATABASE_NAME);
我什么都没得到。没有错误。
答案 0 :(得分:2)
您必须使用mysqli_fetch_array()
或mysqli_fetch_assoc()
或类似功能返回mysqli_query()
查询中的值。见下文:
$query = "SELECT * FROM roster WHERE API='$API'";
$result = mysqli_fetch_array(mysqli_query($dbc, $query));
$address = $result['address'];