PHP Update Data Updates simple instance _php tutorial

Source: Internet
Author: User
SQL Update record update detailed instance

Grammar:

[With [... n]]
UPDATE
[TOP (expression) [PERCENT]]
{{Table_alias | | rowset_function_limited
[With ( [... 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]

[ ]
[From { } [,... N]]
[WHERE {
| {[Current OF
{{[GLOBAL] cursor_name}
| Cursor_variable_name
}
]
}
}
]
[OPTION ( [,... n])]
[ ; ]

::=
{
[server_name. database_name. schema_name.
| database_name. [Schema_name].
| Schema_name.
]
Table_or_view_name}

Example PHP Tutorial

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.";

?>


Updating data with Update

Mysql_connect ("Mysql153.secureserver.net", "Java2s", "password");
mysql_select_db ("Java2s");

$rowID = "0001";
$name = "Kate";
$price = "12";

$query = "UPDATE Employee SET name= ' $name ', price= ' $price ' WHERE id= ' $rowID '";
$result = mysql_query ($query);

if ($result)
echo "

The developer has been successfully updated.

";
Else
echo "

There was a problem updating the developer.

";

?>

http://www.bkjia.com/PHPjc/630745.html www.bkjia.com true http://www.bkjia.com/PHPjc/630745.html techarticle SQL update records update verbose instance syntax: [With common_table_expression [... n]] update [TOP (expression) [PERCENT]] {{Table_alias | Object | rowset_function_limited [With ...

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