Professional Documents
Culture Documents
Lis 211 Quiz
Lis 211 Quiz
Both Java and JavaScript are Object Oriented Programming languages and many
of their programming structures are similar. However, These two are totally
different languages. Java can stand on its own while JavaScript must be placed on
an HTML document to function. Java is also more complicated language that
creates “standalone” applications (which must be compiled before it can be run
on the web) while JavaScript contains a much smaller and simpler set of
commands run through a browser.
I N S E R T I N G J AVA C R I P T S
HEAD SECTION
BODY SECTION
E X T E R N A L JAVA S C R I P T
J AVA S C R I P T O U T P U T
JAVASCRIPT OUTPUT
▪ The following are different ways to display contents using JavaScript which is
writing into:
▪ JavaScript variables hold values or expression. These are case sensitive and
must begin with a letter or underscore, the value may be changed during the
script execution.
DECLARATION
▪ Use the var keyword plus the name of the variable. A value may
immediately be assigned to the variable, use quotes around the string
values. If a variable that is not yet been declared is assigned a value, the
variable will implicitly be declared.
VARIABLE DECLARATION
D ATA T Y P E S
DATA TYPES
JavaScript variables can hold many data types: numbers, strings, arrays, objects
and more.
DATA TYPES
▪ The JavaScript variables can hold different data types.
▪ In this case, the same variable name can hold different data types.
JAVASCRIPT COMMENTS
▪ JavaScript comments are used to make the code look readable as well as to
explain codes. It can also be used to prevent the code from running while
testing alternative codes. It is not executed and ignored by the browser.
▪ For multi line comment use /* for the start and */ for the end.
J A V A S C R I P T O P E R AT O R S
ARITHMETIC OPERATORS
SPECIAL OPERATOR
ASSIGNMENT OPERATORS
COMPARISON OPERATORS
LOGICAL OPERATORS
J AVA S C R I P T E V E N T S
WHAT ARE JAVASCRIPT EVENTS?
▪ These are things that the browser or user does. When events are detected, you
may want to do something, and JavaScript events allows you to execute codes
when something happens.
• Microsoft Access
• MySQL
• SQL Server
• Oracle
WHAT IS SQL?
A means Apache
M means MariaDB
P means PHP
P means Perl
SEARCH XAMPP Control Panel
CLICK ON THE TWO START
CLICK ON ADMIN IN MYSQL
MYSQL ADMIN PAGE
1 . D ATA B A S E
1 . 1 C R E AT I N G D ATA B A S E
CREATE DATABASE
CREATE DATABASE
1 . 2 D E L E T I N G D ATA B A S E
DROP DATABASE
DROP DATABASE
2 . TA B L E
CREATE TABLE
CREATE TABLE
TYPE THEN CLICK SAVE…
2 . 1 A LT E R TA B L E
ADD COLUMN
TO ADD COLUMN
TYPE THEN CLICK SAVE…
UPDATE COLUMN
TO UPDATE COLUMN
TYPE THEN CLICK SAVE…
DROP COLUMN
TO DROP COLUMN
DROP TABLE
TO DROP TABLE
TO ADD PRIMARY KEY
CREATED STUDENTS’ TABLE
3. RECORDS
3.1 MANAGING RECORDS
INSERT RECORD
TO INSERT RECORD
INSERT FOLLOWING RECORDS
UPDATE RECORD
TO UPDATE RECORD
UPDATED RECORD
DELETE RECORD
TO DELETE RECORD
3.2 SELECTING RECORDS
SELECT ALL RECORD
SELECT BY COLUMN
SELECT DISTINCT RECORD
SQL ALIASES
CONCAT + ALIAS
SELECTING RECORDS
WITH CONDITIONS
WHERE CLAUSE
EQUAL (=) AND NOT EQUAL (!=)
GREATER (>) & LESS (<)
AND OPERATOR
OR OPERATOR
NOT OPERATOR
IN OPERATOR
BETWEEN OPERATOR
COUNT OPERATOR
AVG & ROUND OPERATOR
MIN & MAX OPERATOR
SUB QUERIES
SUB QUERIES
ORDER BY (ASC OR DESC)
END OF
L E S S O NE N D O F
CHAPTER
Prepared by Mr. Renato L. Adriano II, CICT
HISTORY OF PHP
In 1994, an incredibly forward-
thinking man named Rasmus Lerdorf
developed a set of tools that used a
parsing engine to interpret a few
macros here and there. He
eventually combined these tools
with a form interpretation (FI)
package he had written, added some
database support, and released what
was known as PHP/FI.
WHAT IS PHP?
• Its official name is PHP Hypertext Preprocessor and
it’s a server-side scripting language.
• It is like JavaScript in that it allows to embed little
programs (scripts) into the HTML code of a web
page.
• The key difference between JavaScript and PHP is
the stage of loading the web page at which these
embedded programs are executed. Server-side
language like PHP are run by the web server,
before ending the web page to the browser while
Client-side language like JavaScript uses browsers
to processes the code instead of the web server.
WHAT IS PHP? Cont.
• PHP can be used on all major operating
systems.
• PHP is open source, which means it’s FREE! It
is very fast, with no hidden cost.
• It is an OOP language and MySQL makes it
cooler plus the language is closer to
Java/C/C++.
PHP SYNTAX
SAMPLE PHP CODE
CONCATENATE
P H P O P E R AT O R S
ARITHMETIC OPERATORS
ASSIGNMENT OPERATORS
COMPARISON OPERATORS
INCREMENT/DECREMENT
LOGICAL OPERATORS
STRING OPERATORS
PHP VARIABLES
VARIABLE DECLARATIONS
P H P VA R I A B L E S C O P ES
GLOBAL SCOPE
LOCAL SCOPE
STATIC SCOPE
GLOBAL KEYWORD
GLOBAL KEYWORD
RETURN KEYWORD
RETURN KEYWORD
$_GET & $_POST
STEP #1 CREATE register.php
STEP #1 CREATE register.php
STEP #2 CREATE register2.php
OUTPUT
$_SESSION
Session variables hold information about one single user and
are available to all pages in one application.
STEP #1 CREATE session.php
STEP #2 CREATE session2.php
OUTPUT
P H P I F S TAT E M E N T
IF…ELSEIF…ELSE
P H P L O O P I N G S TAT E M E N T
FOR LOOP
WHILE LOOP
DO WHILE LOOP
PHP FUNCTIONS
USER-DEFINED FUNCTION
P H P D AT E & T I M E
GETTING A SIMPLE TIME
GETTING A SIMPLE DATE
PHP STRING FUNCTIONS
PHP STRING FUNCTIONS
PHP HEADER()
STEP #1 CREATE redirect.php
STEP #2 CREATE redirect2.php
NOTE: Open your browser and try to access redirect.php. You must always be redirected
in the Second page and will not see First page.
OUTPUT
MORE INFO…
STEP #1 CREATE redirect3.php
NOTE: Open your browser and try to access redirect3.php. You are able to access
the First page and after 3 seconds will be redirected to Second page.
OUTPUT
PHP EMPTY()
PHP empty()
PHP ISSET()
PHP isset()
PHP INCLUDE
It is possible to insert the content of one PHP file into another PHP file
(before the server executes it), with the include or require statement.
STEP #1 CREATE main.php
STEP #2 CREATE aboutus.php
NOTE: Open your browser and access main.php. You will see main.php and aboutus.php
contents together in one page.
OUTPUT
PHP & SQL
SAMPLE LOG-IN FORM
STEP #1
C R E AT E D ATA B A S E
1.1 CREATE DB (project)
1.2 CREATE Table (login)