gpt4 book ai didi

php - 在php中不使用while循环查看所有表字段值

转载 作者:行者123 更新时间:2023-11-29 11:32:56 26 4
gpt4 key购买 nike

使用while循环查看所有表字段值,但相同的值重复多次。

怎么解决...??请有人帮助我吗?

$tender_select_query ="SELECT * FROM new_tender_one,new_tender_two,new_tender_three,new_tender_four WHERE new_tender_one.id = new_tender_two.tender_id AND new_tender_one.id = new_tender_three.tender_id AND new_tender_one.id = new_tender_four.tender_id";
$tender_select_result =mysql_query($tender_select_query);
while($tender_row = mysql_fetch_assoc($tender_select_result)){
$id =$tender_row['id'];
$work_name =$tender_row['work_name'];
$procuring_entity =$tender_row['procuring_entity'];
$reference_no =$tender_row['reference_no'];
$procurement_method =$tender_row['procurement_method'];
$bid_eligibility =$tender_row['bid_eligibility'];
$last_date =$tender_row['last_date'];
$pre_tend_info =$tender_row['pre_tend_info'];
$comp_work =$tender_row['comp_work'];
$tend_security =$tender_row['tend_security'];
$tend_instruction =$tender_row['tend_instruction'];
$tend_invite =$tender_row['tend_invite'];
$cont_details =$tender_row['cont_details'];
$publish_date =$tender_row['publish_date'];
$tender_status =$tender_row['tender_status'];

$tender_id =$tender_row['tender_id'];
$tender_type =$tender_row['tender_type'];
$tender_type_subcat =$tender_row['tender_type_subcat'];

$item_name =$tender_row['item_name'];
$item_description =$tender_row['item_description'];
$item_offer =$tender_row['item_offer'];
$quantity =$tender_row['quantity'];
$unit_type =$tender_row['unit_type'];

$required_name =$tender_row['required_name'];

enter image description here

最佳答案

问题是query你用过。

如果你有同样的tender_idnew_tender_onenew_tender_two等等,你肯定会得到多行。

<强> new_tender_one

id  | tender_title
1 | tender_1
2 | tender_2

<强> new_tender_two

tender_id | tenderer_name
1 | smith
1 | john
2 | paul

<强> result

id  | tender_title | tender_id | tenderer_name
1 | tender_1 | 1 | smith
1 | tender_1 | 1 | john
2 | tender_2 | 2 | paul

确保没有重复 tender_id表中的 s new_tender_two , new_tender_three , new_tender_four .

如果有,则必须使用子查询。那么你需要知道是哪个record您需要其他 tables 。 (例如:对于 id 1 是否 smithjohn )。

关于php - 在php中不使用while循环查看所有表字段值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37098129/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com