【发布时间】:2011-12-23 22:46:17
【问题描述】:
是否可以在记录中存储指向另一条记录的“链接”?例如:
table USERS
id name link
-------------------------------------------------------
1 user1 [link to record with id=4 in table info]
所以,在 PHP 中,我可以这样做:
// connect to the database etc....
$query = "select * from users where id=1";
$result = mysql_query($query);
$another_result = mysql_result($result, 0, 'link');
这样$another_result 会以与使用mysql_query() 调用相同的原始格式存储另一个查询的结果。
这可能吗?
【问题讨论】:
-
也可以称之为 SQL:$another_result = mysql_result(mysql_query($result[0]['link']));