1. NAME OF STAFF :S.SAYI PRIYA
NAME OF STUDENT :S.N.SWETHA
REGISTER NUMBER :CB17S 250445
CLASS :III-BCA-B
BATCH :2017-2020
YEAR :2020
SUBJECT CODE :MCA511
WEB TECHNOLOGIES
2. PHP FILES
OPENING FILES:
The PHP f open() function is used to open a file. It
requires two arguments stating first the file name and
then mode in which to operate.
Files modes can be specified as one of the six options in
this table.
3. S.NO MODE&PUURPOSE
1 r
Opens the file for reading only.
Places the file pointer at the beginning of the file.
2 r+
Opens the file for reading and writing.
Places the file pointer at the beginning of the file
3 W
Opens the file for writing only.
Places the file pointer at the beginning of the file
and truncates the file to zero length.
4 w+
Opens the file for reading and writing only.
Places the file pointer at the beginning of the file.
and truncates the file to zero length.
5 a
Opens the file for writing only.
Places the file pointer at the end of the file.
If files does not exist then it attempts to create a file.
6 a+
4. CLOSING FILES:
After making a changes to the opened file it is important to close it
with the f close() function. The f close() function requires a file
pointer as its argument and then returns true when the closure
succeeds or false if it fails.
READING A FILES:
Once a file is opened using f open() function it can be read
with a function called f read(). This function requires two
arguments. These must be the file pointer and the length of the
file expressed in bytes.
The files length can be found using the file size() function
which takes the file name as its argument and returns the size
of the file expressed in bytes.
5. So here are the steps required to read a file with PHP.
Open a file using f open() function.
Get the file's length using file size() function.
Read the file's content using f read() function.
Close the file with f close() function.
WRITING A FILE:
A new file can be written or text can be appended to an existing file
using the PHP f write() function. This function requires two arguments
specifying a file pointer and the string of data that is to be written.
Optionally a third integer argument can be included to specify the
length of the data to write. If the third argument is included, writing
would will stop after the specified length has been reached.
6. MY SQL DATABASE
MY SQL DATABASE:
INSERT:
To insert data into a My SQL table, you would need to use the
SQL INSERT INTO command. You can insert data into the My
SQL table by using the my sql > prompt or by using any script
like PHP.
7. Syntax:
INSERT INTO table name ( field1, field2,...field N )
VALUES
( value1, value2,...value N );
INSERTING DATA FROM THE COMMAND PROMPT:
To insert data from the command prompt, we will use SQL
INSERT INTO command to insert data into My SQL table
tutorial table.
My SQL prompt while pressing the enter key without giving a
semicolon at the end of each line of the command.
EXAMPLE:
we have not provided a tutorial _ id because at the time of table
creation, we had given AUTO_INCREMENT option for this field. So
My SQL takes care of inserting these IDs automatically.
Here, NOW() is a My NSQL function, which returns the current date
and time.
8. UPDATE:
There may be a requirement where the existing data in a My SQL table
needs to be modified. You can do so by using the
SQL UPDATE command. This will modify any field value of any My
SQL table.
Syntax:
UPDATE table _ name SET field1 = new-value1,field2 = new-value2
[WHERE Clause]
DELETE:
If you want to delete a record from any My SQL table, then you can
use the SQL command DELETE FROM. You can use this command
at the my sql > prompt as well as in any script like PHP.
9. Syntax:
DELETE FROM table _ name [WHERE Clause]
JOIN:
You can use JOINS in the SELECT, UPDATE and DELETE
statements to join the My SQL tables. We will see an example
of the LEFT JOIN also which is different from the simple My
SQL JOIN.
My SQL LEFT JOIN:
A My SQL left join is different from a simple join. A My SQL LEFT
JOIN gives some extra consideration to the table that is on the left.
If I do a LEFT JOIN, I get all the records that match in the same way
and IN ADDITION I get an extra record for each unmatched record in
the left table of the join: thus ensuring (in my example) that every
AUTHOR gets a mention.
10. GROUP BY:
The SQL GROUP BY clause is used in collaboration with the
SELECT statement to arrange identical data into groups. This GROUP
BY clause follows the WHERE clause in a SELECT statement and
precedes the ORDER BY clause.
Syntax:
SELECT column1, column2
FROM table _ name
WHERE [ conditions ]
GROUP BY column1, column2
ORDER BY column1, column2
11. AGGREGATE FUNCTION:
Aggregate functions in DBMS take multiple rows from
the table and return a value according to the query.
All the aggregate functions are used in Select statement.
Syntax:
SELECT <FUNCTION NAME> (<PARAMETER>)
FROM <TABLE NAME>
AVG Function:
This function returns the average value of the numeric
column that is supplied as a parameter.
Example: Write a query to select average salary from
employee table.
Select AVG(salary) from Employee
COUNT Function:
The count function returns the number of rows in the
result. It does not count the null values.
12. Example: Write a query to return number of rows where salary >
20000.
Select COUNT(*) from Employee where Salary > 20000;
Types:
COUNT(*): Counts all the number of rows of the table including
null.
COUNT( COLUMN_NAME): count number of non-null values in
column.
COUNT( DISTINCT COLUMN_NAME): count number of distinct
values in a column.
MAX Function:
The MAX function is used to find maximum value in the column
that is supplied as a parameter. It can be used on any type of data.
Example: Write a query to find the maximum salary in employee
table.
Select MAX(salary) from Employee
13. SUM Function:
This function sums up the values in the column supplied as a
parameter.
Example: Write a query to get the total salary of employees.
Select SUM(salary) from Employee
STDDEV Function:
The STDDEV function is used to find standard deviation of the
column specified as argument.
Example: Write a query to find standard deviation of salary in
Employee table.
Select STDDEV(salary) from Employee
VARIANCE Function:
The VARIANCE Function is used to find variance of the column
specified as argument.
Example:
Select VARIANCE(salary) from Employee
14. FORMAT:
Here Format Name represents the name of the format. The field
line is the specific way, the data should be formatted. The values lines
represent the values that will be entered into the field line. You end the
format with a single period.
Syntax:
Format Name = Field line;
Value _ one, value _ two, value _ three
Field line
Value _ one, value _ two.
USING THE FORMAT:
In order to invoke this format declaration, we would use
the write keyword −
write EMPLOYEE;
15. The problem is that the format name is usually the name of an open
file handle, and the write statement will send the output to this file
handle. As we want the data sent to the STDOUT, we must associate
EMPLOYEE with the STDOUT filehandle. First, however, we must
make sure that that STDOUT is our selected file handle, using the
select() function.
select(STDOUT);
We would then associate EMPLOYEE with STDOUT by setting the
new format name with STDOUT, using the special variable $~ or
$FORMAT_NAME as follows −
$~ = "EMPLOYEE";
16. CASE STUDIES:
My SQL Enterprise:
Z-appos Uses My SQL to Power its Growth & Exceptional Customer Service
Booking.com Serves One Million Visitors per Day with My SQL Enterprise
Unlimited
Click ability Dramatically Improves Performance and Scalability with My SQL
Query Analyzer
My SQL Embedded Server:
My SQL Helps Simply Accounting by Sage Increase Revenue, Market Share, and
Customer Satisfaction
Con-ceiviums Relies on My SQL to Perform Real-Time Analytics for BlackBerry
Enterprise Server
Adobe Relies on My SQL to Make Creative Professionals More Productive
My SQL Cluster:
My SQL Cluster Powers Leading Mobile Media Publishing Platform
Cash point Saves Half a Million Euros per Year as it Bets on My SQL
Shopatrons uses My SQL Cluster to Power its Rapidly Growing e-Commerce
Service
Plus net Achieves Continuous Availability of AAA Services with My SQL Cluster
Alcatel-Lucent uses My SQL Cluster Carrier Grade Edition to Handle over 60
million Subscribers