PHP interview question Series 3 [Answer]-PHP source code

Source: Internet
Author: User
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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.