Home  >  Article  >  Backend Development  >  请问怎么获取PHP页面中靠查询数据库后输出一个记录的表格中记录的状态

请问怎么获取PHP页面中靠查询数据库后输出一个记录的表格中记录的状态

WBOY
WBOYOriginal
2016-06-13 12:56:09970browse

请教如何获取PHP页面中靠查询数据库后输出一个记录的表格中记录的状态?
如题,也就是有个表格是靠数据库输出的,多条记录中有个字段是是否支付,输出后怎样获取这个表格的项是否含有未支付的状态?

例如:
编号 名称 是否支付
1    苹果 已支付
2    香蕉 已支付
3    葡萄 已支付

这样的话就返回值为真,一个按钮可以点击。

如果:

例如:
编号 名称 是否支付
1    苹果 已支付
2    香蕉 已支付
3    葡萄 未支付

就返回假,这个按钮设置为不可以点击的状态。

请教,谢谢。


------解决方案--------------------
php输出mysql结果是靠数组,提取数组中是否支付的字段,挨个判断

按钮状态依照是否支付来决定
------解决方案--------------------
<br />
	while($row=mysql_fetch_array($result)){<br />
		$ar[]=$row["支付状态列"];<br />
	}<br />
	foreach($ar as $key=>$value){<br />
		if($value=="未支付"){<br />
			echo "<input type=\"button\" id=\"$key\" diabled=\"disabled\"/>";<br />
		}else{<br />
			echo "<input type=\"button\" id=\"$key\" \/>";<br />
		}<br />
	}<br />
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn