Database query Form Values

Source: Internet
Author: User

1. Common methods for linking databases: conn.php<?PHP//First step: Link database [email protected]_connect ("localhost:3306", "root", "root") or Die ("MySQL link failed");//Second step: Select the specified database, Sets the character set @mysql_select_db ("Php_blog", $conn) or Die ("DB link Failed". mysql_error ()); mysql_query (' Set NAMES UTF8 ') or Die ("CharSet set Error"); ?>2. Query Judgment select.php<?php include ("conn.php"),//Introduce the link database <pre name= "code" class= "HTML" ><?php include ("conn.php");//introduce the linked database if ( !empty ($_get[' id ')) {$sql = "SELECT * from news where id= '". $_get[' id ']. "'"; $query =mysql_query ($sql); $rs =mysql_fetch_ Array ($query); Determine if the $RS has a value indicating that the database exists, otherwise the database does not exist;}?> <formAction= "add.php"Method= "POST">Title:<inputtype= "text"name= "title"><BR>content:<textarearows= "5"cols= " the"name= "Con"></textarea><BR> <inputtype= "Submit"name= "Sub"value= "POST"> </form> 

Database query Form Values

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.