mysql 错误 1066 [英] mysql error 1066

查看:83
本文介绍了mysql 错误 1066的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$id=$_GET["id"];
$query= "
SELECT
blomster_produkter.blomster_produkt_id,
blomster_produkter.blomster_produkt_navn,
blomster_produkter.blomster_produkt_pris
FROM
blomster_produkter
INNER JOIN blomster_produkter ON 
blomster_produkter.FK_blomster_produkt_id=blomster_produkter.blomster_produkt_navn     
blomster_produkter.FK_blomster_produkt_id=blomster_produkter.blomster_produkt_pris
blomster_produkter.FK_blomster_produkt_id=blomster_produkter.blomster_produkt_id
WHERE FK_blomster_kategori_id=$id";

为什么这会向我抛出 mysql 错误 1066?

Why is this throwing me an mysql error 1066?

(如果我遗漏了一些重要的东西,也很抱歉,这是我在 stackoverflow 上问的第一个问题)

(also sorry if i am missing some important stuff, this is the first question i am asking on stackoverflow)

推荐答案

0.1 秒的谷歌搜索:mysql 错误 1066" - 不是唯一的表名/别名

0.1 seconds of googling: "mysql error 1066" - not unique table name/alias

    FROM
    blomster_produkter   <--table #1
    INNER JOIN blomster_produkter ON   <-table #2

您不能在不使用别名的情况下将表连接到自身,或在连接中重复使用相同的表名:

you cannot join a table to itself, or re-use the same table name in a join, without using an alias:

FROM blomster_produkter
INNER JOIN blomster_produkter AS someothername ON
                             ^^^^^^^^^^^^^^^^^--- the alias

然后根据需要在连接条件中更改表引用.

and then changing table references as necessary in your join conditions.

另外,请注意您对 sql 注入攻击持开放态度.享受您的服务器 pwn3d.

As well, note that you are wide open to sql injection attacks. Enjoy having your server pwn3d.

这篇关于mysql 错误 1066的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆