读取数据库代码

WBOY
Release: 2016-06-13 12:56:02
Original
1000 people have browsed it

求一个读取数据库代码
求一个独立页面代码 本人不懂编程 不要给提示思路什么的
 先谢谢各位大大mysql账号132 密码456读取库名aa 表名bb 表里的CC列假设读取CC字段前500个数值 读取数值9字符记录有多少个9字符 并且显示到网页上如有10个网页显示10 无则显示0 


------解决方案--------------------
<br />
	@mysql_connect("localhost","123","456");<br />
	@mysql_select_db("aa");<br />
	mysql_query("set names utf8");<br />
	$result=mysql_query("select cc from bb limit 0,500");<br />
	while($row=mysql_fetch_array($result)){  <br />
		$ar[]=$row['cc']; <br />
	}<br />
	$cnt=count($ar);<br />
	for($i=0;$i<$cnt;$i++){<br />
		if($ar[$i]==9){<br />
			$b[]=$i;<br />
		}<br />
	}<br />
	$cnt_b=count($b);<br />
	if($cnt_b>0){<br />
		echo $cnt_b;<br />
	}else{<br />
		echo 0;<br />
	}<br />
Copy after login

------解决方案--------------------
$result=mysql_query("select order_state from order limit 500");<br />
$counter=0;<br />
while($row=mysql_fetch_array($result)){  <br />
    if($row[0]==9) $counter++; <br />
}<br />
echo $counter;
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!