Entry-level PHP database connection classes

  code is as follows copy code Class MySQL Tutorial {      private $host;      private $name;       private $pass;     function __construct ($host, $name, $pass) {         $ This->host= $host;         $this->name= $name;   

Introduction to PHP-php pagination display Instances

Make a paging display Database Tutorial Connections The code is as follows Copy Code ?$conn =mysql Tutorial _connect ("127.0.0.1", "", "");mysql_select_db ("Shop");?> The key is to use the limit in the SQL

How to create a database and datasheet in PHP

$CN = MySQL tutorial _connect (' localhost ', ' root ', ');mysql_select_db (' Test ', $CN);Creating a Databasemysql_query ("Create datebase ' test ';");Creating data Tables$sql = "CREATE TABLE IF not EXISTS ' test ' (' ID ' int (8) not NULL

PHP Entry User Login instance code and tutorial

md5

First step /*First create the data table directly copy to your phpMyAdmin directly run on OK. 1 CREATE TABLE IF not EXISTS ' useradmin ' (' ID ' int (4) not NULL auto_increment,' username ' varchar default NULL,' userpass ' varchar default NULL,'

PHP Cookie Instance

PHP Cookie InstanceHere is a PHP cookie to set the user login time and expiration time code OH function Logincookie ($uid, $name, $group, $ip, $time){Global $site _domain, $login _key;$domain = (substr ($site _domain,0,4) = = "www.")? substr ($site

PHP Simple database importer [. sql file]

function Insert_file ($file, $replace = ' ") {Global $Charset;$readfiles =read_file ($file);if ($replace) {$readfiles =str_replace (' $timestamp ', ' $timestamp ', $readfiles);}$detail =explode ("n", $readfiles);$count =count ($detail);for ($j =0;

Use php encoding-instance call (3)

Include_once ("mime. inc ");$ Mm = new MIME ();$ To = "customer@263.net ";$ Subject = $ mm-> encode ("mall", "gb2312"); // code$ Msg = "successfully registered member ";$ Msg. = "member name: wayne ";$ Msg. = "Password: wayne ";$ Headers = "From:

Php program for sending attachments (2)

Class html_mime_mail {     Var $ headers;Var $ body;Var $ multipart;Var $ mime;Var $ html;Var $ html_text;Var $ html_images = array ();Var $ cids = array ();Var $ do_html;Var $ parts = array ();     /*****************************************

Use php to send emails with attachments

Refer to the online articles. As the saying goes, you will not copy a large copy of the article. The key is to use it for me. This is the most important thing. Let's go.In fact, sending mail is very simple. php has ready-made functions. You can

PHP converts scientific notation to the original numeric string

The code is as follows:Copy code Function NumToStr ($ num ){If (stripos ($ num, 'E') == false) return $ num;$ Num = trim (preg_replace ('/[= \' "]/','', $ num, 1),' "'); // Scientific notation is displayed, returns a string.$ Result = "";While ($

Php array addition element (available associated array) summary

1. Add elements to a one-dimensional array$ ArrayList = ArrayListay ();Array_push ($ ArrayList, el1, el2... eln );But there is actually a more direct and convenient way: The code is as follows:Copy code $ ArrayList = ArrayListay ();$ ArrayList []

Php record IP address to prevent repeated form submission

Example The code is as follows:Copy code Session_start ();If (empty ($ _ SESSION ['IP']) // The first write operation to determine whether the ip address is recorded and whether to write data to the database{$ _ SESSION ['IP'] = $ _ SERVER

PHP image Upload instance analysis [including preview]

Knowledge points to be learned in the early stageMove_uploaded_file () file upload function The code is as follows:Copy code If (move_uploaded_file ($ _ FILES ["filename"] ["tmp_name"]){Echo 'file uploaded successfully ';} $ _ FILES php global

Php searches for file programs of the specified directory size

Let's first look at the Directory Traversal The code is as follows:Copy code Function tree ($ directory){ $ Mydir = dir ($ directory );Echo " n ";While ($ file = $ mydir-> read ()) { If (is_dir ("$ directory/$ file") AND ($ file! = ".") AND ($

Php two ways to print and output a board

Example 1 The code is as follows:Copy code /*** Change the color of every row and column* String fun_table (int $ rows = 9, int $ cols = 9)* $ Rows indicates that the number of rows must be an integer and must be between 1 and 20* $ Cols

Example of php getting and displaying the QQ avatar

Because I log on several times and the connection speed is very slow, I gave up. Of course, there are too many message plug-ins. For example, it's a bit of a hot talk now, but it's still a problem for friends who haven't registered many words. For

Php method for saving session in memcached

1. First install memcached or memcache softwareSee wamp for detailed instructions on installing memcache/memcached.2. Install php_memcache.dll extension3. Set the session to be saved in memcachedMethod 1:Modify the php. Ini file The code is as

Example of unlimited topic category reading in Php

How to implement the Infinitus topic classification idea: get the auto-increment ID (that is, the parent ID) and then obtain the sub-ID (that is, the uid sub-id) data in the database as follows:Id: 1 uid: 0 I'm column 1Id: 2 uid: 1 I'm column 2Id: 3

Php code for forcibly running advertisements

In this way, after one access, no advertisement will be called. In this way, it's amazing. No advertisement will be skipped. Second, it can increase revenue.The code is as follows:  The code is as follows:Copy code Session_start ();$ LifeTime = 2

Total Pages: 12780 1 .... 10639 10640 10641 10642 10643 .... 12780 Go to: GO

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.