Ec (2); 1. Use php to write a simple query, find all the content with the name & ldquo; James & rdquo;, and print out the table UserName & nbsp; & nbsp; Tel & nbsp; & nbsp; script ec (2); script
1. Use php to write a simple query, find all the content named "Zhang San" and print it out.
Table Name User
Name Tel Content Date
Zhang San 13333663366 graduated from college-10-11
Michael Zhang graduated from 13612312331 undergraduate course-10-15
Zhang Si 021-55665566 graduated from technical secondary school 2006-10-15
2. Complete the code based on the above question:
$ Mysql_db = mysql_connect ("local", "root", "pass ");
@ Mysql_select_db ("DB", $ mysql_db );
3. How to use the following classes and explain what the following means?
Class test
{
Get_test ($ num)
{
$ Num = md5 (md5 ($ num). "En ");
Return $ num;
}
}
4. Print "Shanghai aiji" with javascipt"
5. Format of writing SQL statements: insert, update, and delete
6. What technologies do you know about PHP or are you good?
Answer:
1. SELECT Name, Tel, Content, Date FROM User WHERE Name = ''zhang san''
2. $ mysql_db = mysql_connect ("local", "root", "pass ");
@ Mysql_select_db ("DB", $ mysql_db );
$ SQL = "SELECT Name, Tel, Content, Date FROM User WHERE Name = ''zhang san ''";
$ Result = mysql_query ($ SQL );
While ($ row = mysql_fetch_array ($ result ))
{
Echo $ row [''name'']. ''''. $ row [''tel'']. ''''. $ row [''content''].''
''. $ Row [''date']."
Rn ";
}
3.
Usage:
$ Get_test = new test ();
$ Result = $ get_test-> Get_test (2 );
The $ num variable is returned after two md5 operations. The parameter in 2nd md5 operations adds En after the first md5 ($ num) operation.
4.
<>
Write (''shanghai aij '');
5.
Insert
Insert into table (a1, a2, a3) S ($ val1, ''$ val2', $ val3 );
Modify
UPDATE table SET a1 = $ a1, a2 = ''$ a2'' WHERE id = 3;
Delete
Delete from table WHERE id = 3;
6.
Play by yourself