When using PHP for development, you need to create many similar variables either early or late.
Without many similar variables, you can store data as elements in an array.
All elements in the array have their own IDs, so they can be easily accessed.
There are three types of Arrays:
Numeric Array
Array with digit ID key
Example
$ Names = array ("Peter", "Quagmire", "Joe ");
Echo $ names [1]. "and". $ names [2]. "are". $ names [0]. "'s neighbors ";
Output of the above Code:
Quagmire and Joe are Pe
Griffin in 35 Glenn Quagmire 33
The following example updates some data in the "Person" table:
$ Con = mysql_connect ("localhost", "peter", "abc123 ");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}
Mysql_select_db ("my_db", $ con );
Mysql_query ("UPDATE Person SET Age = '36'
WHERE FirstName = 'Peter 'AND LastName = 'grigin '");
Mysql_close ($ con );
?>
After this update, the "Person" table is as follows:
FirstName LastName Age
Peter
This is the 100 best fonts ever selected by the German fontshop website.Based on three criteriaSales volume (weight 40%), historical value (weight 30%), and aesthetic value (30%). At the same time, all fonts that participate in the selection are commercial fonts and do not contain free fonts, OS built-in font, and thatFonts used in some standard software (Arial, verdana, etc ). For a list of detailed results, see German version 100 Best fonts (PDF ).
Top 30 optimal Fonts
100 Best fonts (includin
In the process of developing using PHP, sooner or later, you will need to create many similar variables.
Without a lot of similar variables, you can store the data as an element in an array.
The elements in an array have their own IDs, so you can easily access them.
There are three types of arrays:
Numeric array
An array with a numeric ID key
Example
$names = Array ("Peter", "Quagmire", "Joe");
echo $names [1]. "and". $names [2]. "Are". $names [0]. "' s Neighbors";
The output of the abo
from table name where expression
For example: Delete a record in table MyClass that is numbered 1Mysql> Delete from MyClass where id=1;
The following is a comparison of the tables before and after the data is deleted.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of a PHP code that deletes all lastname= '
Examples of PHP and Ajax MySQL databases
The user information is listed here.This example contains four elements:MySQL DatabaseA simple HTML formA JavaScriptA PHP Web pageDatabaseWe will use this database in this example to look like this:
ID
FirstName
LastName
Age
Hometown
Job
1
Peter
Griffin
41
Quahog
Brewery
2
Lois
ignoring the barrier barrage.
Phoenix Series Fighter Analysis:
Phoenix Series fighter is a powerful combat, which mainly embodies its scope of continuous damage, rapid and uninterrupted missile attack, will not waste any output, but also has a handsome appearance, is indeed the game in the later of the choice. This series of fighters from low to high, respectively, is the Raptor 0 (highest level 25), Gale Warhawk (highest 30), Storm Griffin (highes
table MyClassMysql> Delete from MyClass where id=1;Here is a comparison of the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table: After this deletion, the table i
the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
Glenn
Quagmire
33
5.7 Modify data syntax in table: Update table name SET fi
of the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table: After this deletion, the table is like this:
FirstName
LastName
Age
the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
comparison of the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
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 dataExample: Viewing the first 2 rows of data in a table MyClassMysql> SELECT * from MyClass ORDER by ID limit 0, 2;Select is typically used with where to query for more accurate and complex data. 5.6 Delete Table Data command: Delete from table name where expressionExample: Deleting a record with number 1 in table MyClassMys
: Viewing the first 2 rows of data in a table MyClassMysql> SELECT * from MyClass ORDER by ID limit 0, 2;Select is typically used with where to query for more accurate and complex data. 5.6 Delete Table Data command: Delete from table name where expressionExample: Deleting a record with number 1 in table MyClassMysql> Delete from MyClass where id=1;Here is a comparison of the table before and after deleting the data.
FirstName
LastName
Age
Peter
the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table is like this:
FirstName
LastName
Age
Glen
of the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table: After this deletion, the table is like this:
FirstName
LastName
Age
1 in table MyClassMysql> Delete from MyClass where id=1;Here is a comparison of the table before and after deleting the data.
FirstName
LastName
Age
Peter
Griffin
35
Glenn
Quagmire
33
The following is an example of PHP code to delete all Lastname= ' Griffin ' records in the "Persons" table:After this deletion, the table
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.