updating data in a databaseThe UPDATE statement is used to modify data in a database table.Grammar== some_valuenotes: SQL is not case sensitive. Update is equivalent to update.In order for PHP to execute the above statement, we must use mysql_query (function. This function is used to send queries and commands to a SQL connection.ExampleEarlier, we created a table named "Persons" in this tutorial. It looks something like this:The following example updates some of the data for the "Persons" table:
PHP uses the MySQL database, from the establishment connection to the display of the results.The complete code is as follows:PHP//Connect to MySQL$db=mysql_connect("localhost", "root", "root");if(!$db) { die(' Could not connect: '.Mysql_error()); }//Create a databaseif(!mysql_query("CREATE DATABASE my_db",$db)) { Echo"Error Creating Database:".Mysql_error(); }//Select Databasemysql_select_db("my_db",$db);//Create a table$sql= "CREATE TABLE Persons (FirstName varchar (), LastName varchar ()
two records into table MyClass, these two records indicate that: 1 is named Tom with a score of 96.45, 2 for the named Joan, and 82.99 for the number 3.mysql> INSERT INTO MyClass values (1, ' Tom ', 96.45), (2, ' Joan ', 82.99), (2, ' Wang ', 96.59);Note: INSERT into only one record can be inserted into the table at a time.5.5 Querying the data in a table1), query all rowsCommand: Select Example: View all data in table MyClassMysql> select * from MyClass;2), query the first few rows of dataExam
It is equally important to decide what not to do and decide what to do. --Jobs, 1997Tren Griffin the beginning of his blog post with Steve Jobs, to tell the reader that the discussion in this article will be limited to what jobs has given him about business (not his personality, etc.). At the same time, it is important for Steve Jobs to say these words to understand his words.1. In terms of computer hardware, if the boss is lucky, the best staff and t
MySQLOrder By keyword is used to classify the data in the record.MySQL Order By Keyword ClassificationOrder by keyword is used to classify the data in the record.MySQL Order By syntaxSELECT column_name (s)FROM table_nameOrder by column_nameNote: The SQL statement is a "case-insensitive" Statement (which does not distinguish between uppercase and lowercase letters), that is, "ORDER BY" and "order by" are the same.MySQL Order By caseThe following example shows how to select all records from the "P
continue to combine the Sencha mobile and desktop frameworks. There will be a cross-border possibility for the widgets in the future.The complete Code and demo sample of the new widget can be found here. Enjoy it and let us know what you think.Don GriffinDon Griffin is a member of the EXT JS core team. He is an Ext JS user for 2 years before joining Sencha and have over years of software engineering experience on a Broa D range of platforms. His expe
expressionFor example, delete the record numbered 1 in MyClass.Mysql> delete from MyClass where id = 1;The following is a comparison between tables before and after data deletion.
FirstName
LastName
Age
Peter
Griffin in
35
Glenn
Quagmire
33
The following uses the PHP code as an example to delete all LastName = 'grigin' records in the "Persons" table:
After this deletion, the table is as follows:
the MyClass table.Mysql> select * from MyClass order by id limit 0, 2;
Select is generally used with where to query more precise and complex data.
5.6 delete table data Command: delete from table name where expression
For example, delete the record numbered 1 in MyClass.Mysql> delete from MyClass where id = 1;
The following is a comparison between tables before and after data deletion.
FirstName
LastName
Age
Peter
Griffi
MySQLOrderBy syntax MySQL Order By keyword is used to classify data in records.
MySQL Order By Keyword classification
Order by keyword is used to classify the data in the record.
MySQL Order By syntax
SELECT column_name (s)FROM table_nameOrder by column_name
Note: the SQL statement is a "case-insensitive" statement (which does not distinguish between uppercase and lowercase letters), that is, "ORDER BY" and "order by" are the same.
MySQL Order By case
The following example shows how to select a
column_name (s)
FROM table_name
Order by column_name
Note: the SQL statement is a "case-insensitive" statement (which does not distinguish between uppercase and lowercase letters), that is, "ORDER BY" and "order by" are the same.
MySQL Order By case
The following example shows how to select all records from the "Person" table and classify the "Age" column:
$ Con = mysql_connect ("localhost", "peter", "abc123 ");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}
Mysql_select_d
This article mainly introduces how to add new cells to table rows using javascript, and involves the techniques of Dynamic javascript operations on tables, for more information about how to add a new cell to a table row by using JS, see the following example. Share it with you for your reference. The details are as follows:
The following JS code inserts a new cell into the row with the specified id in the table.
Script function insCell () {var x = document. getElementById ('tr1'). insertCe
adaptability with XHTML and CSS
Page: 249
Press: Tsinghua University Press
Pricing: 49.8
Frame loading: Flat Loading
Publishing year: 2006
Bytes -------------------------------------------------------------------------------------------------------------------
2. Web standard learning website recommendation
Foreign classic Website:(You are welcome to add this post, only for technical sites)
World Wide Web Consortium
Website: http://www.w3.org/
456 Berea Street(Author: Roger Johansson)
This article mainly introduces how to control the text alignment of table lines in javascript, and involves related techniques related to javascript operations on Table Styles, for more information about how to control the text alignment of table lines in Javascript, see the following example. Share it with you for your reference. The details are as follows:
The following JS Code can control the entire line of text in the table to align to the left or right
Script function leftAlign () {do
This article mainly introduces how to use javascript to align the content of specified cells in a control table. It involves the techniques of javascript to operate table cell content styles and has some reference value, for more information about how to align the content of a specified cell in the control table, see the example in this article. Share it with you for your reference. The details are as follows:
The following code controls the right alignment of the table cell content
Script
Keyword of the order by command of MySQL in PHP
Is used to sort data records.Keyword of this commandIs used to sort data records.By default, records sorted by command keywords are sorted in ascending order.If you want to sort records in a descending order, you can use the description of the keyword.Syntax
SELECT column_name(s)FROM table_nameORDER BY column_name(s) ASC|DESC
For more information about SQL, see our SQL tutorial.For exampleIn the following example, all data is stored in the "person"
results according to the "Age" column:
The Code is as follows:
$ Con = mysql_connect ("localhost", "peter", "abc123 ");If (! $ Con){Die ('could not connect: '. mysql_error ());}Mysql_select_db ("my_db", $ con );$ Result = mysql_query ("SELECT * FROM Persons order by age ");While ($ row = mysql_fetch _ ($ result )){Echo $ row ['firstname'];Echo "". $ row ['lastname'];Echo "". $ row ['age'];Echo"";}Mysql_close ($ con );?>
Output of the above Code:
, LastName, Age)VALUES ('Peter ', 'Griffin', '35 ')");Mysql_query ("insert into person (FirstName, LastName, Age)VALUES ('Glenn', 'quagmire', '33 ')");Mysql_close ($ con );?>
Insert data from the form into the database
Now, we create an HTML form that inserts a new record into the "Person" table.
Here is the HTML form:
When you click the submit button in the HTML form in the preceding example, the form data is sent to "insert. php ". The "insert. php
Nmon (also known as Nigel rsquo; sMonitor) is a very common system performance monitoring tool developed by IBM engineer nielgriiths and suitable for AIX and Linux operating systems. This tool can directly display the resource utilization of the current operating system on the screen to help you identify system bottlenecks and assist in system tuning. Thanks to its fame, we have made a simple recommendation in the article "Recommended Linux utility", which is a great tool. With Nmon, you can ea
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.