作为用户,我想在我登录时查看我的配置文件。我想查看的数据来自使用user_id的另一个表。如何使用user_id从另一个表中获取数据
我试过下面的代码,但是我得到了表中的所有数据。我试过使用session_id,但它不起作用。
这里是我的代码:
<div>
<table style="border: 2px solid black;">
<tr>
<th>Users Id</th>
<th>Language from</th>
<th>Language to</th>
<th>Category name</th>
<th>Message</th>
<th>File Name</th>
<th>Number of words of file</th>
<th>Count of words paste</th>
<th>Total</th>
</tr>
<?php
//$user_id = $_SESSION['user_id'];
$res = mysql_query("SELECT * from checkout JOIN users WHERE users.user_id = checkout.user_id");
while($row = mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row['user_id']; ?></td>
<td><?php echo $row['language_from']; ?></td>
<td><?php echo $row['language_to']; ?></td>
<td><?php echo $row['category_name']; ?></td>
<td><?php echo $row['message']; ?></td>
<td><?php echo $row['file']; ?></td>
<td><?php echo $row['file_count']; ?></td>
<td><?php echo $row['word_count']; ?></td>
<td><?php echo $row['total']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
请尽量帮我,你们...
使用'WHERE'子句使用用户ID – Ghost
'WHERE users.user_id = checkout.user_id'我试过了,但它有相同的输出 – angel1108
使用这个WHERE users.user_id = checkout.user_id AND users.user_id = $ user_id''$ user_id = $ _SESSION ['user_id']' –