douxi3233 2018-12-31 08:23
浏览 78
已采纳

查询从两个不同的表中获取数据

I have two tables. Table A and B. I have a log-in form where I will get the username,password, assign, assign2 of the user from table A and fetch data depending on the user's assign1 and assign2 from table B.

How my query would look like? Looking for answers. Thankyou so much.

Table A -THIS IS THE TABLE FOR LOG-IN FORM
==========================================
username | password | assign1 | assign2 |
------------------------------------------
SANDRA   | SANTOS   |    1    |   1     | //Values
--------------------------------------------

Table B - 
=======================================

name | assign1 | assign 2 |
------------------------------
DADA |  1      |   1      |  //this will be displayed
------------------------------
gorg |  2      |    2     | 

//this must not be displayed since the user assign1 and assign2 who logged in did not match to this

  • 写回答

3条回答 默认 最新

  • dongqiaogouk86049 2018-12-31 08:45
    关注

    You are using $sql variable in

    $result = $con->query($sql);

    It should be $queryagain.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起