internet and web quiz 3

5.0(1)
studied byStudied by 41 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/35

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

36 Terms

1
New cards

what is PHP

  • stands for “PHP: hypertext preprocessor”

  • an interpreted programming language that is used to build webpages

2
New cards

why is PHP preferred over alternative languages for web development *

  • it is popular?

  • open-source

  • embedded within HTML, making it easy to integrate dynamic content into web pages

3
New cards

how do you set variables in PHP

  • variable names start with a $ in PHP

  • followed by a word that describes the info held

  • equals sign in the assignment operator

4
New cards

scalar (primitive) data types in PHP

  • string - represents text

    • $name = ‘pinecone’ (fuck this cat bro)

  • int/float - two types of number data types

    • int - whole numbers

    • decimal - fractions, $number = 3.75

  • boolean (TRUE/FALSE)

  • NULL - represents nothing, not set

5
New cards

T/F, variables are updateable in php

true

6
New cards

compound data type (non-primitive) in PHP

  • arrays

7
New cards

how are php objects/arrays similar to JS?

  • both can be accessed by their index

  • associative access (essentially means that you can access both by property)

  • dynamic structure

8
New cards

how are php objects/arrays different to JS? *

  • syntax differs

  • different methods

  • iteration is different

9
New cards

How to work with classes and objects and do things like access object

properties/methods, etc

class Car

{

// properties

public $brand;

public $model;

// methods

public function start() {
return “The {$this → brand} {$this→model} is starting.”; }

}

// creating an object

$myCar = new Car(“toyota”, “camry”)';

// accessing an object

echo $myCar → brand; // outputs Toyota

10
New cards

how to work with indexed and associative arrays

11
New cards

how we access/handle data from different HTTP methods(ties into REST, what should a POST do?

  • some http methods include post, get, put, delete, patch

  • post should submit data to be processed by the server

12
New cards

what does MVC stand for

  • model, view, controller

  • separates an application into three main components built to handle specific development aspects of an application

13
New cards

what is model

  • interacts with database and perfroms data manipulation

14
New cards

what is view

  • represents the presentation layer - displaying user interface

  • usually HTML templates that may include embedded PHP code

15
New cards

what is controller

  • acts as an intermediary between the model and the view

  • receives user input, processes requests, and updates the model

16
New cards

what is REST

  • stands for “representational state transfer”

  • makes it easier for systems to communicate with each other

17
New cards

validation

  • making sure that the data coming in from the front end is correct

  • first step - escape any harmful characters

18
New cards

why do we need to escape data

  • escaping data will remove bad scripts

  • we don’t want hackers to send us malicious code

  • escaping data involves removing and replacing any characters that should not appear in a value

19
New cards

what are sessions

  • store information about a user and their preferences on the server

  • called sessions because they only store the data for the duration of a single visit to the site

20
New cards

how do sessions work

  • every page that uses sessions should call the session_start()

  • this automatically creates a session cookie for the browser

  • temporary, session cookies are deleted when the browser is closed

21
New cards

cookies

  • a website can tell a browser to store data about the user in a text file called a cookie

  • each time the browser requests another page from that site, the browser sends the data in the cookie back to the server

22
New cards

how do cookies work

  • php has a set_cookie() function to create a cookie

  • to access, $_COOKIE super global array

23
New cards

what is SQL

  • stands for “structured query language”

  • it is the standard language for database creation and manipulation

24
New cards

what is MySQL

  • a relational database program that uses SQL queries

25
New cards

what is a regional database

  • includes tables, rows, columns, fields, keys

26
New cards

what are select statements

  • select species the columns with the ‘select’ keyword

  • and the intended table with the ‘from’ keyword

27
New cards

what is the where clause

28
New cards

what are joins in SQL

  • ‘join’ is a keyword that allows you to request data from more than one table

  • join are generally how we make use of relationships

29
New cards

join types - idk how important this is

30
New cards

what are relationships

  • established associations between two or more tables

  • based on common fields from more than one table, often involving primary and foreign keys

31
New cards

primary keys

  • the field that is used to uniquely identify each record in a table

  • cannot be NULL, must be unique, and there can be only one defined per table

32
New cards

foreign keys

  • a field (or fields) in one table that references the primary key in another table

33
New cards

PDOs

  • represent and manage the connection to the database

  • set up a connection and then run queries though it

  • via PDOs, PHP is going to take sql as input and return results from the database and store it in a variable

34
New cards

what are prepared statements

  • prepared statements help guard against SQL injection hacks

  • will automatically run escaping functions on the params about to be used

35
New cards

SQL injection

  • a hack when a hacker tries to run malicious SQL code in a database

36
New cards