Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Web.doc
Скачиваний:
0
Добавлен:
19.02.2020
Размер:
77.82 Кб
Скачать

21. Show how to add data to tables? sql insert into Syntax

It is possible to write the INSERT INTO statement in two forms.

The first form does not specify the column names where the data will be inserted, only their values:

INSERT INTO table_name VALUES (value1,value2,value3,...);

The second form specifies both the column names and the values to be inserted:

INSERT INTO table_name (column1,column2,column3,...) VALUES (value1,value2,value3,...);

22. Show how to retrieve data from SQL Tables?

The general form of the SELECT statement appears below:

SELECT select_list FROM source WHERE condition(s) GROUP BY expression HAVING condition ORDER BY expression

23. Show how to update data in DB using SQL Queries?

The sql update Statement

The UPDATE statement is used to update existing records in a table.

Sql update Syntax

UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value;

UPDATE Customers

SET ContactName='Alfred Schmidt', City='Hamburg'

WHERE CustomerName='Alfreds Futterkiste';

25. Show how authorization works in PHP

<?php // define $authorized = true only if user is authenticated if (authenticated_user()) {  $authorized = true; } // Because we didn't first initialize $authorized as false, this might be // defined through register_globals, like from GET auth.php?authorized=1 // So, anyone can be seen as authenticated! if ($authorized) { include "/highly/sensitive/data.php"; }?>

26. What is Session in PHP?

A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application.

<?php session_start(); ?> <html> <body></body></html>

27. What is Cookies in PHP?

A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.

<?php setcookie("user", "Alex Porter", time()+3600); ?> <html>

28. Show how to make Mail in PHP.

The PHP mail() function is used to send emails from inside a script.

Syntax

mail(to,subject,message,headers,parameters)

Php Simple e-Mail

The simplest way to send an email with PHP is to send a text email.

In the example below we first declare the variables ($to, $subject, $message, $from, $headers), then we use the variables in the mail() function to send an e-mail:

<?php $to = "someone@example.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent.";?>

30. Show main differences between Client and Server Side scripting languges?

An HTML file can contain HTML tags, text and scripts.

Server-side scripting is about "programming" the behavior of the server. This is called server-side scripting or server scripting.

Client-side scripting is about "programming" the behavior of the browser. (see Web JavaScript chapter).

Normally, when a browser requests an HTML file, the server returns the file. However, if the file contains a server-side script, the script is executed on the server before the file is returned to the browser as plain HTML.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]