Read database code

Source: Internet
Author: User
Ask for a read database code and an independent page code & nbsp; I do not understand programming & nbsp; do not give tips or something & nbsp; thank you for your large mysql account 132 & nbsp; password 456 read database name aa & nbsp; table name bb & nbsp; The CC column in the table assumes that the first 500 values of the CC field are read. & nbsp; read 9-character records of 9-Character & nbsp; and displayed on the webpage. if 10 pages are displayed, 10 & nbsp; read the database code.
Ask for an independent page code. I don't know programming. don't give me any tips or something.
Thank you! mysql account 132 password 456 read database name aa table name bb table CC column assuming read CC field first 500 Read value 9 Character record how many 9 characters and displayed if 10 webpages are displayed on the webpage and 10 are not displayed, 0 is displayed.


------ Solution --------------------

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

------ Solution --------------------
$result=mysql_query("select order_state from order limit 500");
$counter=0;
while($row=mysql_fetch_array($result)){
if($row[0]==9) $counter++;
}
echo $counter;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.