作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用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'];
最佳答案
问题是query
你用过。
如果你有同样的tender_id
在new_tender_one
或new_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
是否 smith
或 john
)。
关于php - 在php中不使用while循环查看所有表字段值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37098129/
我是一名优秀的程序员,十分优秀!