0
我已經用下面的代碼attemped它:如果用戶的登錄用戶名與Drupal的另一個表中的用戶名相匹配,我該如何獲取用戶詳細信息?
<?php
session_start();
// connects to the database
$mysqli = new mysqli("localhost", "root", "");
$query = "SELECT First_Name, Last_Name, Balance FROM customers WHERE username = '".$_SESSION['name']."'";
if($result = $mysqli->query($query))
{
while($row = $result->fetch_assoc())
{
echo "<div align=\"center\">";
echo "<br />Your <b><i>Profile</i></b> is as follows:<br />";
echo "<b>First name:</b> ". $row['First_Name'];
echo "<br /><b>Last name:</b> ".$row['Last_Name'];
echo "<br /><b>Balance:</b> ".$row['balance'];
echo "</div>";
}
$result->free();
}
else
{
echo "No results found";
}
我得到以下錯誤:
Notice: A session had already been started - ignoring session_start() in include_once() (line 2 of C:\wamp\www\drupalNew\sites\all\modules\New_Balance\balance_module.module).
Notice: Undefined index: name in include_once() (line 7 of C:\wamp\www\drupalNew\sites\all\modules\New_Balance\balance_module.module).
我想這給關於誰是Drupal的7個網站登錄的用戶的詳細信息。