我有两个表customer和customer_pro,其中customer表的 customerID 是自动递增的,customer_pro表的 cus_billId 也是自动递增的。
这两个表都有不同的字段,如customer = customerID , name , amount , updAmount customer_pro = cus_billID , customerID , month , year ....
我想根据当前的 cus_billID打印customer_pro 中的所有信息,并根据选定的customerID从 customer 表中打印amount和updAmount
我使用什么命令来获得所需的结果?
customer_pro的 Html 表单的示例输入,例如
Select customerID ........(**All **customerID** from customer Table)
Select Month ........
select Year ........
提交
当用户按下提交按钮时,所有信息将插入customer_pro表中,并根据当前自动递增的cus_billID显示这些信息,并根据选定的 html 表单customerID显示客户表中的金额和updAmount
INNER JOIN用于连接两个具有主键和外键的表您的查询将如下所示:$sql = "SELECT * FROM customer_pro INNER JOIN customer ON customer_pro.customerID = customer.customerID";
然后您必须使用执行 sql 查询
$result = mysqli_query($dbconn, $sql;)
之后创建一个表并使用
while(mysqli_fetch_array($result))
{
your table fields here
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句