【发布时间】:2015-12-13 10:37:41
【问题描述】:
我在数据库中有three tables。
单引号
两种类型
三位作者
在quotes表中,我已经分配了type_id,它是types表中的主键,还有author_id,它是authors表的主键。
现在,当我想以这种格式一次回显一个引号时。
"When you get to my age life seems little more than one long march to
and from the lavatory."
By: A. C. Benson Category: age
那么如何连接这个数据库来得到这种类型的输出呢?
我试过了,但它只输出报价。
$sql = "SELECT * FROM quotes LIMIT 1";
$result = $con->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo " \" " . $row["quote"]. "\"<br><br>";
}
【问题讨论】:
-
您的代码/数据库中的类别和类型是否相同?还有,你能展示一下报价表的结构吗?
-
是的类别表示类型,我有链接图像puu.sh/lTNGq/320fd6af2e.png
标签: php mysql database jointable