Two methods for connecting to MYSQL through PHP 2

Source: Internet
Author: User
Two methods for connecting to MYSQL through PHP are copyrighted: bluemy/php Chinese users reprinted. please contact the author for example to see my articles in the program and code of this website and the following routines: in front-end HTML, you can enter the following table or contact likaSyntaxHighlighter by email. all ();

Two methods for connecting to MYSQL through PHP
Copyright: bluemy/php Chinese users
For more information, contact the author.
The example shows my article in "program and code" on this website and the following routine:
Foreground HTML
You can enter a table in the interval or use the power
Sub-mail contact, likai333@21cn.com.
Your name:
Your email:
The website address you want to advertise:
The website name you want to advertise:
Your Company name:
Your Contact number:

Backend PHP
<? Php
$ Dbh = mysql_connect (localhost: 3306, root ,);
Mysql_select_db (HBWEB );
$ Query = "insert into usemsg (name, usermail, userurl, sitename, company, phone) values ($ name, $ usermail, $ userurl, $ sitename, $ company, $ phone, $ C1, $ C2, $ C3, $ C4, $ C5 )";
$ Res = mysql_query ($ query, $ dbh );
$ Err = mysql_error ();
If ($ err ){
Echo "an error occurred. please notify me ";
Echo "$ err ";
}
Else
{Echo "successful warehouse receiving ";}
? >
Table structure:
Create table usemsg (
Name varchar (255) not null default "notname ",
Usermail varchar (255) not null default "notusermail ",
User URL varchar (255) not null default "notuserurl ",


Sitename varchar (255) not null default "notsitename ",
Company varchar (255) not null default "notcompany ",
Phone varchar (255) not null default "notphone ",
);

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.