如果他们用户名与Drupal上另一个表中的用户名匹配,如何提取用户详细信息?

时间:2015-06-26 11:28:47

标签: drupal drupal-7

我已使用以下代码对其进行了测试:

<?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站点的用户的详细信息。

1 个答案:

答案 0 :(得分:1)

只需使用:

${config.foo}