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 generates a simple example of a static page

A simple example:News template file news_tmp.html:{title}{news_title}{news_image} {news_content}______________________________________________________________________________________________Answer 7:News Generation file aaa.php:?Let's say the

PHP Get picture size

? $arr =getimagesize ("Images/album_01.gif"); Echo $arr [3]; $strarr =explode ("" ", $arr [3]); echo $strarr [1]; ?> demo picture and so on scale shrink

Php generates ip addresses on images

The code is as follows:Copy code $ Img = imagecreate (180,50 );$ Ip = $ _ server ['remote _ addr '];Imagecolortransparent ($ img, $ bgcolor );$ Bgcolor = imagecolorallocate ($ img, 0x2c, 0x6d, 0xaf); // background color$ Shadow =

Php scaling down images

The code is as follows:Copy code Function imageresize2 ($ width, $ height, $ targetw, $ targeth){$ Percentage = 1;If ($ width> $ targetw) | ($ height> $ targeth ))  {$ Width_diff = $ width-$ targetw;$ Height_diff = $ height-$ targeth; If ($ width_

Php verification code program

The code is as follows:Copy code Session_start ();$ Im = imagecreatetruecolor (100,30 );// Assign color$ Bg = imagecolorallocate ($ im, 0, 0 );$ Textcolor = imagecolorallocate ($ im, 255,255,255 );// Mark the imageFor ($ I = 0; $ I $ Te1 =

Php image operations (1/3)

The code is as follows:Copy code Class image {Public $ filename;Private $ info;Private $ im;  // ConstructPublic function _ construct ($ filename ){$ This-> filename = $ filename;$ This-> info = @ getimagesize ($ filename );If ($ this-> info [2]>

Php code for adding a text watermark and an image watermark to an image (1/2)

$ Image-> wprint_img (); // executes the image watermark.$ Image-> wprint_string (); // execute a text watermark*/ The code is as follows:Copy code Class editimage {Private $ imagefile; // image filePrivate $ smallimg; // watermark imagePrivate $

Php generates a graphic verification code

$ Height = 300;$ Width = 300;// Create a background image$ Im = ImageCreateTrueColor ($ width, $ height );// Assign color$ White = ImageColorAllocate ($ im, 255,255,255 );$ Blue = ImageColorAllocate ($ im, 0, 0, 64 );// Draw the color to the

Php imagecreate instance tutorial

Php imagecreate instance tutorialDescriptionResource imagecreate ($ width, $ height)Imagecreate () returns an image identifier representing a blank image of the specified size.We recommend that you use imagecreatetruecolor ().Check itemsHeader

Php verification code generation program

Php verification code generation program$ Consts = 'bcdfghjkmnpqrstwxyz ';$ Vowels = 'aei23456789 ';For ($ x = 0; $ x  {$ Const [$ x] = substr ($ consts, mt_rand (0, strlen ($ consts)-1), 1 );$ Vow [$ x] = substr ($ vowels, mt_rand (0, strlen ($

A typical PHP watermarking program for images

/*************************************** **********************Parameter description:$ Max_file_size: size limit of the uploaded file, in bytes$ Destination_folder: File Upload path$ Watermark: whether to add a watermark. (1 indicates adding a

PHP functions used to determine the IP format

Function is_ip ($ str ){If (! Strcmp (long2ip (sprintf ("% u", ip2long ($ ip), $ ip) return 1;Else return 0;}Or (used in earlier versions)Function is_ip ($ str ){$ Ip = explode (".", $ str );If (count ($ ip) 4) return 0;Foreach ($ ip as $ ip_addr ){

Php email sending code-mail

The code is as follows:Copy code send a mail to the network administrator network administrator reception Sender: Topic: Content: Hello, Webmaster: Php code The code is as follows:Copy code If (empty ($ from) or empty ($ subject)

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 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 ($

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 date difference 8 small time solution

The initialization statement for adding time to the program: "date_default_timezone_set (" asia/shanghai ");Definition and usageThe date_default_timezone_set () function sets the default timezone used by all date/time functions.The

Total Pages: 12780 1 .... 11742 11743 11744 11745 11746 .... 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.