Small doubts encountered in PHP (with accompanying notes)

Source: Internet
Author: User
Tags add time
Minor problems with PHP (accompanying notes)
MySQL:
1. Distinct field constraints for extracting data that is not duplicated in 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. Timestamp the date of the calculation, for example, for the information in the last week:
SELECT * FROM table where Dateline > (Unix_timestamp () -3600*24*7)
4. Get daily Records in the last 30 days:
Select count (ID), date (addtime) from Ad_user where Date_sub (Current_date (), Interval-day) <=addtime Group by date (add Time);

php:
1. Htmlspecialchars_decode () Restores the extracted HTML-style encoding
2, the direct output of SQL writing for conditional detection, such as: echo "to detect the specific SQL statement";
3, the database pre-defined connections, such as $dblink, for functions, you must first declare this variable,
such as: function Getmysql () {
Global $dblink;
The specific implementation code
}
4, JS write the Path value format:
Such as:
Phptime= ' +time+ ' &methods=ex&cid= ' +cid+ ' &classtime= ' +classtime;
return phptime;
5, ranking: The following:
$paiming = $dblink->mem_fetch_only ("Select COUNT (Score) from T_sum_account WHERE score> (select score from T_sum_ac Count WHERE uid= $cyask _uid) ", 0);
$paiming = $paiming + 1;//to rank people with the same score
6, insert the database before you must determine whether the time zone is correct, or as a comparison to determine the time period of the conditions when the trouble can be big, eat such a loss so first write down:
Date_default_timezone_set ("Asia/shanghai"), $now = time (), so that the timestamp of today is absolutely no problem,
7, edit the template used to use DW, the results of the preview effect of Firefox use normal, IE is always to the left to run, style changes, which may be introduced by other file encoding inconsistent caused by the OH
8, the Local installation development environment, for the domain name this piece, to configure two places:
C:\WINDOWS\SYSTEM32\DRIVERS\ETC hosts
D:\workspace\wamp\Apache2\conf\extra httpd-vhosts.conf
9, how to make a picture, Link has form submit function?
Onclick= "Document.formName.submit ()"
10. The number of elements in the array: Count ($arrayname)


  • Related Article

    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.