使用php和sqlite从多个表中的列中选择数据

我正在为多个表创建一个登录名。 我已经检查了一些SO答案,例如这里。</ p>
\ n

但我似乎无法理解这是如何工作的? 下面是我的php select语句</ p>

  SELECT export.uname AS exportName,export.pword AS exportPword,
import.uname AS importName,import.pword AS importPword,
lba .uname AS lbaName,lba.pword AS lbaPword
WHERE exportName ='$ username'AND exportPword ='$ password',
importName ='$ username'AND importPword ='$ password';
</ code> </ pre>

但是我收到了这个错误:</ p>


警告:SQLite3 :: query():无法准备语句:17,靠近“, “:第15行的C:\ xampp \ htdocs \ xport \ login.php中的语法错误</ p>

警告:SQLite3 :: querySingle():无法准备语句:1,模糊列名 :在第17行的C:\ xampp \ htdocs \ xport \ login.php中取消名称
信息不正确</ p>
</ blockquote>

我不知道错误来自何处 因为我真的不明白如何从多个表中进行选择。</ p>

如果这是一个表我只能输入:</ p>

  SELECT  * FROM表WHERE uname ='$ username'和pwo  rd ='$ password'; 
</ code> </ pre>

我要问的是如何从多个表中执行此操作。 谢谢我提前。</ p>
</ div>

展开原文

原文

I am creating a login for multiple tables. I have checked some SO answers like here.

but I can't seem to understand how this works? Below is my php select statement

SELECT export.uname AS exportName, export.pword AS exportPword, 
       import.uname AS importName, import.pword AS importPword, 
       lba.uname AS lbaName, lba.pword AS lbaPword 
WHERE exportName = '$username' AND exportPword = '$password', 
      importName = '$username' AND importPword = '$password';

But I get this error:

Warning: SQLite3::query(): Unable to prepare statement: 17, near ",": syntax error in C:\xampp\htdocs\xport\login.php on line 15

Warning: SQLite3::querySingle(): Unable to prepare statement: 1, ambiguous column name: uname in C:\xampp\htdocs\xport\login.php on line 17 Information incorrect

I don't know where the error is coming from because I don't really understand how to select from multiple tables.

If this was one table I could just type:

SELECT * FROM table WHERE uname = '$username' AND pword = '$password';

All I am asking is how to do this but from multiple tables. Thanks i advance.

duanchuaiwan0063
duanchuaiwan0063 如果您知道如何从多个表中选择数据,请帮忙。我是一个新的PHP。如果您知道我可以阅读的任何文档以帮助,我将不胜感激
3 年多之前 回复
dongxie7683
dongxie7683 where子句也是错误的。你不能使用,指定多个条件
3 年多之前 回复
duanji9264
duanji9264 查询中没有FROM子句,但您似乎引用了三个表:export,import和lba。
3 年多之前 回复
dongqie5529
dongqie5529 我在SELECT查询中看不到TABLE,并且在WHERE语句中也有一个','
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问