Uncover the five common database problems that occur in PHP applications-including database schema design, database access, and business logic code that uses the database-and their solutions.
If only one way to use the database is correct ...
You can create database design, database access, and database-based PHP business logic code in a number of ways, but in the end it usually ends in error. This article explains the five common problems that occur in the database design and the PHP code that
.
object's PropertiesProperties are made up of key-value pairs, which are the names of the properties and the values of the properties. The name of the property is a string, and the value can be any JavaScript object (all objects in JavaScript, including functions). For example, declare an object:
Copy Code code as follows:
Declaring an Object
var jack = new Object ();
Jack.name = "Jack
If only one way to use the database is correct, you can create database design, database access, and database based PHP business logic code in a number of ways, but the end result is usually a mistake. This article describes the five common problems that arise in the database design and the PHP code that accesses the database, and how to fix them when they are encountered.
question 1: Use MySQL directly
A common problem is that older PHP code uses the MYSQL_ function directly to access the dat
In the words of the company sent an e-mail, to a technology provider named Jack, by the way, the senior leaders, which is usually just into the job of small staff. This jack is a partner of a technical consultant, this technical problem 3 leadership, 3 leadership also can not solve, casually a call to ask Jack, call, someone else
of an object and an object is the instantiation of a class. A class does not represent a specific thing, but an object represents a specific thing.
>>> Class people:... Def speak (self ):... Print ("hello! ")...'''
Defines a people class, defines a speak method, but does not define attributes,
Because the attribute does not belong to a class, it belongs to instances of various classes. That is, it belongs to the object.
Therefore, we can set different attributes for each instance.
'''>>> Class
. build/envsetup.shm : Compile all the modulesmm : Compile the module under the current directory, android.mk file in the current directorymmm : Compiles the module under the specified path, with the Android.mk file under the specified path!!! need to execute before compiling:. build/envsetup.sh, otherwise the error cannot find the command xxRef:link
Reference:Get Source codeTsinghua University open source software mirror StationCodenames, Ta
Chen Anzhi of:
Rule One 3% of the world's people have a strong motivation for success .
In this world, the proportion of successful people is about 3%, the average person is 97%. In the end why someone will succeed, to become the 3% of people, some people will become ordinary people for a lifetime, become 97%? Where is the difference between the two?
In the past 17 years, I have visited 100 of the world's first, from the Olympic gold, the world's richest man, best-selling author, to the head
Data | database | questions
Expose five common database problems that occur in PHP applications-including database schema design, database access, and business logic code that uses the database-and their solutions.If only one way to use the database is correct ...
You can create database design, database access, and database based PHP business logic code in a number of ways, but in the end it usually ends in error. This article describes the five common problems that arise in the database design
');mysql_select_db (' users ');
$res = mysql_query ("Select ID from Users WHERE login= '". $name. "");while ($row = Mysql_fetch_array ($res)) {$id = $row [0];}
return $id;}
Var_dump (get_user_id (' Jack '));? >
Note Use the Mysql_connect function to access the database. Also note the query, which uses string concatenation to add $name parameters to the query.
There are two good alternatives to this technique: the PEAR DB module and the PHP Data Objec
();where P is a strong reference and will not be recycled by GC at any time/** * 测试强类型,可以看到我们调用多次gc他还是没有回收 */privatestaticvoidtestStrongReference() { new Person("Jack"); System.gc(); System.gc(); System.out.println(jack);}SoftReferenceSoft references his feature is that when memory is sufficient, objects of this reference type are not recycled, and are recycled only when there is insufficient me
.
Preparations
1. create a test database
Create database testQuery
2. create a test table
CREATE TABLE table1( uid VARCHAR(10) NOT NULL, name VARCHAR(10) NOT NULL, PRIMARY KEY(uid))ENGINE=INNODB DEFAULT CHARSET=UTF8;CREATE TABLE table2( oid INT NOT NULL auto_increment, uid VARCHAR(10), PRIMARY KEY(oid))ENGINE=INNODB DEFAULT CHARSET=UTF8;
3. Insert data
Insert into table1 (uid, name) VALUES ('AAA', 'Mike '), ('BBB', 'Jack'
The use of foreach is often used in PHP, and it is necessary to use a foreach array. So, in this article, we're talking about arrays while we talk about foreach.
foreach has two types of syntax:
The first: Iterate over the given array statement array_expression array. In each loop, the value of the current cell is assigned to the $value and the pointer inside the array is moved forward one step (so the next cell in the next loop will be taken).
foreach (array_expression as $value) statement
This article describes the use and examples of foreach in PHP, details the use of foreach, and the interested partners can refer to it.
The use of foreach is often used in PHP, and it is necessary to use a foreach array. So, in this article, we're talking about arrays while we talk about foreach.
foreach has two types of syntax:
The first: Iterate over the given array statement array_expression array. In each loop, the value of the current cell is assigned to the $value and the pointer inside t
5. chown and chgrp commands
We can guess what they do from their names, but these two commands require root permissions.
The CHOWN command is in the format of user: group in the middle of chown User: group file. A part can be omitted as needed. For example, if a file belongs to user Bob, Bob has the rwx permission, Bob belongs to group group1, and group1 has the r permission. Another user, Jack, belongs to group2.
Chown
C ++ Primer (fifth edition) Study Notes _ 9 _ Standard Template Library _ multimap multi-map container, _ 9_multimap
C ++ Primer (fifth edition) Study Notes _ 9_standard templates_multimap multi-map container
The multimap container multimap and map structures are basically the same, but because duplicate key values exist, the multimap element insertion, deletion, and search methods are different from those of map.
1. multimap object creation and element insertion
When inserting an element, you
need to be modified. Keep the default value.
Changes to user configuration files take effect immediately without the need to restart svn
4. Start setting passwd User Account Information
# Vim/svn/tshop/conf/passwd
[Users]
Wdd = wdd
Jack = jack
Add the user and password below, each line of username = password
5. Set authz. User access permissions.
# Vim/svn/tshop/conf/authz
[Groups]
Devteam = wdd,
out the number of an element in the listName.reverse () Reverses the elements in the listName.sort () to sort the list elementsname.extend (names2) incorporating name2 into the name listdel name2 You can delete the name2 list4. about shades of a listFirst shallow copyname.copy () It 's a shallow copy .Here is an example of a shallow copy code:1 names = ["Zhafan", "Dean", [1,2,3,4], "Dean", "Dan", "Jack", "Yes", "a", "a"] 2 Names2 = names.copy () 3 pr
The dictionary is the Key-value data typeCreate
info = { ' stu01 ': ' Jack ', ' stu02 ': ' Mike ', ' stu03 ': ' Jay '}
Features of the dictionary:
Dict is disordered.
Key must be unique and inherently heavy
Increase
>>>info[' stu05 ' = ' kit ' #自动创建 {' stu01 ': ' Jack ', ' stu02 ': ' Mike ', ' stu03 ': ' Jay ', ' stu05 ', ' kit '}
By deleting
>
. FOREIGN key is able to refer to its own table, which involves the foreign key of the "self Reference" (self-referential).
5. More information about foreign keys can be referred to foreign key–wikipedia.
Finally we need to create the addresses table in the database, so we need to execute our Create statement via metadata (metadata), and of course skip the tables we've created (such as users):
>>> Base.metadata.create_all (engine)
PRAGMA table_info ("Users")
()
PRAGMA table_info (" Ad
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.