我有 2 个表用户和消息:
包含、、和包含
users
、、、,id
我想选择name
接收
器等于用户的相同 id 的所有行我如何循环它以获取它们?email
password
msgs
id
sender
receiver
link
我尝试做某事但没关系
$name_query = mysql_query("SELECT fullname,id FROM users WHERE email = '$email'");
$name = mysql_fetch_object($name_query);
$user_id = $name->id;
$result = mysql_query("SELECT receiver FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s Name: %s", $row[0], $row[1]);
}
mysql_free_result($result);
?>