internet and web quiz 3

studied byStudied by 41 people
5.0(1)
Get a hint
Hint

what is PHP

1 / 35

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

36 Terms

1

what is PHP

  • stands for “PHP: hypertext preprocessor”

  • an interpreted programming language that is used to build webpages

New cards
2

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

New cards
3

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

New cards
4

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

New cards
5

T/F, variables are updateable in php

true

New cards
6

compound data type (non-primitive) in PHP

  • arrays

New cards
7

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

New cards
8

how are php objects/arrays different to JS? *

  • syntax differs

  • different methods

  • iteration is different

New cards
9

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

New cards
10

how to work with indexed and associative arrays

New cards
11

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

New cards
12

what does MVC stand for

  • model, view, controller

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

New cards
13

what is model

  • interacts with database and perfroms data manipulation

New cards
14

what is view

  • represents the presentation layer - displaying user interface

  • usually HTML templates that may include embedded PHP code

New cards
15

what is controller

  • acts as an intermediary between the model and the view

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

New cards
16

what is REST

  • stands for “representational state transfer”

  • makes it easier for systems to communicate with each other

New cards
17

validation

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

  • first step - escape any harmful characters

New cards
18

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

New cards
19

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

New cards
20

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

New cards
21

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

New cards
22

how do cookies work

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

  • to access, $_COOKIE super global array

New cards
23

what is SQL

  • stands for “structured query language”

  • it is the standard language for database creation and manipulation

New cards
24

what is MySQL

  • a relational database program that uses SQL queries

New cards
25

what is a regional database

  • includes tables, rows, columns, fields, keys

New cards
26

what are select statements

  • select species the columns with the ‘select’ keyword

  • and the intended table with the ‘from’ keyword

New cards
27

what is the where clause

New cards
28

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

New cards
29

join types - idk how important this is

New cards
30

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

New cards
31

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

New cards
32

foreign keys

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

New cards
33

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

New cards
34

what are prepared statements

  • prepared statements help guard against SQL injection hacks

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

New cards
35

SQL injection

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

New cards
36
New cards

Explore top notes

note Note
studied byStudied by 39 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 84 people
Updated ... ago
4.5 Stars(2)
note Note
studied byStudied by 37 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 108 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 15 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 6 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 117249 people
Updated ... ago
4.8 Stars(544)

Explore top flashcards

flashcards Flashcard24 terms
studied byStudied by 26 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard25 terms
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard25 terms
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard84 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard72 terms
studied byStudied by 83 people
Updated ... ago
4.7 Stars(3)
flashcards Flashcard133 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard74 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard31 terms
studied byStudied by 27 people
Updated ... ago
5.0 Stars(1)