How to learn the fifth day of php in ten days

Source: Internet
Author: User
Objective: to learn to read data first read two functions before learning: 1. mysql_query sends a query string. Syntax: intmysql_query (stringquery, int [link_identifier]); return value: integer this function sends the query string for MySQL to do

Objective: to learn to read data

Before learning, let's first look at two functions:
1. mysql_query
Returns a query string. Syntax: int mysql_query (string query, int [link_identifier]); return value: integer

This function sends a query string for MySQL to perform coherent processing or fulfillment. If the link_identifier parameter is not specified, the program will take the initiative to find the latest opened ID. If the query string is UPDATE, INSERT, or DELETE, the return value may be true or false. if the query string is SELECT, a new ID value is returned. if the return value is false, the query string is incorrect instead of successfully executed but no return value.

2. mysql_fetch_object returns class material. Syntax: object mysql_fetch_object (int result, int [result_typ]); return value: Class

This function is used to split the query result into class variables. If the result has no material, false is returned.

Let's look at a simple example:
$ Exec = 'select * from user ';
$ Result = mysql_query ($ exec );
While ($ rs = mysql_fetch_object ($ result ))
{
Echo 'username: '. $ rs-> username .'
';
}
?>
Of course, the table user has a username field, which is similar

Of course, you need to connect to the database first. generally, we require_once ('Conn. php'), while conn. php contains the code used to connect to the database.

The preceding two commands can be used to read data. today we will talk about how to add, delete, and modify data.

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.