Small issues encountered in php (as you may want)-php Tutorial

Source: Internet
Author: User
Small issues encountered in php (as you may have noted) mysql: 1. distinct & nbsp; field constraints for extracting non-duplicated data in the database 2. SELECTCOUNT (*) limit & lt ;! -- Replace with this option to save trouble with small issues encountered in php (as you can remember)
Mysql:
1. distinct field constraints for extracting non-duplicate data from the database
2. select count (*) from t_sum_duihuan WHERE t_pid = 9 or t_pid = 10 or t_pid = 11 or t_pid = 12
3. the timestamp calculates the date, for example, the information of the last week:
Select * from table where dateline> (unix_timestamp ()-3600*24*7)
4. obtain the daily records of the last 30 days:
Select count (id), date (addTime) from ad_user where date_sub (current_date (), interval 30 day) <= addTime group by date (addTime );

Php:
1. htmlspecialchars_decode () restores the encoded html style.
2. directly write SQL statements for condition detection: echo "specific SQL statements to be checked ";
3. the database has predefined connections in advance, such as $ dblink. this variable must be declared before the function is used,
For example, function getmysql (){
Global $ dblink;
// Specific implementation code
}
4. Format of write path value passing in js:
For example:
Phptime = '+ time +' & methods = ex & cid = '+ cid +' & classtime = '+ classtime;
Return phptime;
5. ranking:
$ Paiming = $ dblink-> mem_fetch_only ("select count (score) from t_sum_account WHERE score> (SELECT score FROM t_sum_account WHERE uid = $ cyask_uid)", 0 );
$ Paiming = $ paiming + 1; // sort people with the same score in the same rank
6. before inserting data into the database, you must determine whether the time zone is correctly set. Otherwise, it may be too difficult to compare the conditions for judging the time period. if you have suffered such a loss, you should first write down it:
Date_default_timezone_set ("Asia/Shanghai"); $ now = time (); in this way, the timestamp obtained today is absolutely no problem,
7. I used to use dw when editing the template. in the result preview, Firefox is normal, while ie is always running on the left side. the style changes greatly. This may be caused by inconsistent encoding of other files introduced.
8. when installing the development environment locally, you need to configure the domain name in two places:
C: \ WINDOWS \ system32 \ drivers \ etc hosts
D: \ workspace \ wamp \ Apache2 \ conf \ extra httpd-vhosts.conf
9. how can I enable the form submission function for an image or link?
Onclick = "document. formName. submit ()"
10. number of elements in the array: count ($ arrayname)


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.