Php update data update simple instance

Source: Internet
Author: User
Tags mysql tutorial

SQL update records detailed instance updates

Syntax:

[WITH <common_table_expression> [... n]
UPDATE
[TOP (expression) [PERCENT]
{Table_alias | <object> | rowset_function_limited
[WITH (<Table_Hint_Limited> [... n])]
}
| @ Table_variable
}
SET
{Column_name = {expression | DEFAULT | NULL}
| {Udt_column_name. {property_name = expression
| Field_name = expression}
| Method_name (argument [,... n])
}
}
| Column_name {. WRITE (expression, @ Offset, @ Length )}
| @ Variable = expression
| @ Variable = column = expression
| Column_name {+ = |-= | * = |/= | % = | & = | ^ = | =} expression
| @ Variable {+ = |-= | * = |/= | % = | & = | ^ = | =} expression
| @ Variable = column {+ = |-= | * = |/= | % = | & = | ^ = | =} expression
} [,... N]

[<OUTPUT Clause>]
[FROM {<table_source>} [,... n]
[WHERE {<search_condition>
| {[CURRENT
{[GLOBAL] cursor_name}
| Cursor_variable_name
}
]
}
}
]
[OPTION (<query_hint> [,... n])]
[;]

<Object >::=
{
[Server_name. database_name. schema_name.
| Database_name. [schema_name].
| Schema_name.
]
Table_or_view_name}

Php tutorial for instances

<? Php
Mysql tutorial _ connect ("mysql153.secureserver.net", "java2s", "password ");
Mysql_select_db ("java2s ");

$ Query = "UPDATE Employee SET salary = '39. 99 '";
$ Result = mysql_query ($ query );
Echo "There were". mysql_affected_rows (). "product (s) affected .";

?>


Update Data

<? Php

Mysql_connect ("mysql153.secureserver.net", "java2s", "password ");
Mysql_select_db ("java2s ");

$ Fig = "0001 ";
$ Name = "Kate ";
$ Price = "12 ";

$ Query = "UPDATE Employee SET name = '$ name', price =' $ price' where id = '$ rowid '";
$ Result = mysql_query ($ query );

If ($ result)
Echo "<p> The developer has been successfully updated. </p> ";
Else
Echo "<p> There was a problem updating the developer. </p> ";

 

?>

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.