Two ways to parse PHP connection MySQL _php tutorial

Source: Internet
Author: User
MySQL can be connected to the Web in two ways via PHP, a MySQL-related function via PHP, and an ODBC-related function through PHP.

The relevant functions are as follows:

MySQL function

Mysql_affected_rows: Gets the number of columns affected by MySQL last operation.

Mysql_close: Close the MySQL server connection.

Mysql_connect: Turn on MySQL server connection.

mysql_create_db: Create a new MySQL database.

Mysql_data_seek: Move the internal return indicator.

Mysql_db_query: Send query string (query) to MySQL repository.

mysql_drop_db: Remove the database.

Mysql_errno: Returns the error message code.

Mysql_error: Returns the error message.

Mysql_fetch_array: Returns the array data.

Mysql_fetch_field: Get information about the field.

Mysql_fetch_lengths: Returns the maximum length of the column data.

Mysql_fetch_object: Returns the object data.

Mysql_fetch_row: Returns the columns of each column.

Mysql_field_name: Returns the name of the specified field.

Mysql_field_seek: Sets the indicator to a field that returns a value.

Mysql_field_table: Gets the table name of the current field.

Mysql_field_type: Gets the type of the current field.

Mysql_field_flags: Gets the current field flag.

Mysql_field_len: Gets the length of the current field.

Mysql_free_result: Release returns memory.

MYSQL_INSERT_ID: Returns the ID of the last use of the insert instruction.

Mysql_list_fields: Lists the fields (field) for the specified table.

Mysql_list_dbs: Lists the databases available to the MySQL server.

Mysql_list_tables: Lists the tables (table) for the specified database.

Mysql_num_fields: Gets the number of returned fields.

Mysql_num_rows: Gets the number of returned columns.

Mysql_pconnect: Open MySQL Server long-term connection.

Mysql_query: Send out a query string.

Mysql_result: Gets the result of the query.

mysql_select_db: Select a database.

Mysql_tablename: Gets the table name.

ODBC functions

Using ODBC functions to install MySQL ODBC

Odbc_autocommit: Switch automatic change function.

Odbc_binmode: Sets the binary data processing mode.

Odbc_close: Close the ODBC link.

Odbc_close_all: Closes all ODBC links.

Odbc_commit: Changes to ODBC repositories.

Odbc_connect: links to ODBC repositories.

Odbc_cursor: Gets the cursor name.

ODBC_DO: Executes the SQL instruction.

Odbc_exec: Executes the SQL instruction.

Odbc_execute: Executes the preset SQL instruction.

Odbc_fetch_into: Gets the specified column passed back.

Odbc_fetch_row: Gets a column returned.

Odbc_field_name: Gets the field name.

Odbc_field_type: Get field data form.

Odbc_field_len: Gets the column data length.

Odbc_free_result: Releases the memory that is transmitted back to the data.

Odbc_longreadlen: Sets the maximum value of the pass-back bar.

Odbc_num_fields: Gets the number of fields.

Odbc_pconnect: Long-term connectivity to ODBC repositories.

Odbc_prepare: Preset SQL instructions.

Odbc_num_rows: Gets the number of returned columns.

Odbc_result: Obtain the data returned.

Odbc_result_all: Returns HTML table data.

Odbc_rollback: Undoes the current transaction.

Odbc_setoption: adjust ODBC settings.

Example: Foreground HTML
< form enctype= "Multipart/form-data" action= "hb_ggzd.php" method= "POST" >
< tr >
< TD width= "251" >< small > You can take some time to fill out the form below, or use electricity
Sub-mail contact,< a href= "mailto:likai333@21cn.com" >likai333@21cn.com</a >. </small ></td >
</tr >
< tr >
< TD valign= "top" width= "251" height= "+" >< small > Your name:</small ></td >
< TD width= "462" height= "to" >< small >< input name= "name" size= "> </small ></td >
</tr >
< tr >
< TD valign= "top" width= "251" height= "+" >< small > your email:</small ></td >
< TD width= "462" height= ">< small >< input name=" Usermail "size=" PNs "></small ></td >
</tr >
< tr >
< TD valign= "top" width= "251" height= ">< small > website address you want to advertise:</small ></td >
< TD width= "462" height= ">< small >< small >< input name=" Userurl "size=" PNS "value="/http "> </small ></small ></td >
</tr >
< tr >
< TD valign= "top" width= "251" height= ">< small > website name you want to advertise:</small ></td >
< TD width= "462" height= ">< small >< input name=" sitename "size=" ></small ></td >
</tr >
< tr >
< TD valign= "top" width= "251" height= "+" >< small > Your company name:</small ></td >
< TD width= "462" height= ">< small >< input name=" Company "size=" PNs "></small ></td >
</tr >
< tr >
< TD valign= "top" width= "251" height= ">< small > your contact phone:</small ></td >
< TD width= "462" height= ">< small >< input name=" phone "size=" ></small ></td >
</tr >
< tr >


Background php:
< PHP
= mysql_connect (Localhost:3306,root,);
mysql_select_db (Hbweb);
= "INSERT into usemsg (Name,usermail,userurl,sitename, Company,phone) VALUES (,,,,,,,,,,)";
= mysql_query (,);
= Mysql_error ();
if () {
echo "Error occurred, please notify < a href=mailto:likai333@21cn.com > I </a >";
echo "";
}
Else
{echo "Successfully inbound";}
? >

Table structure:
CREATE TABLE usemsg (
Name varchar (255) NOT NULL default "Notname",
Usermail varchar (255) NOT NULL default "Notusermail",
Userurl varchar (255) NOT NULL default "Notuserurl",
SiteName varchar (255) NOT NULL default "Notsitename",
Company varchar (255) is not null default "Notcompany",
Phone varchar (255) NOT NULL default "Notphone",
);

http://www.bkjia.com/PHPjc/486441.html www.bkjia.com true http://www.bkjia.com/PHPjc/486441.html techarticle MySQL can be connected to the Web in two ways via PHP, a MySQL-related function via PHP, and an ODBC-related function through PHP. The relevant functions are as follows: MySQL function Mysql_affected_ro ...

  • 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.