SQL Update record Update detail instance
Grammar:
[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 OF
{{[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}
Example PHP Tutorial
<?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 with Update
<?php
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 "<p>the developer has been successfully updated.</p>";
Else
echo "<p>there was a problem updating the developer.</p>";
?>