Web Programming Mid-Term
PHP- Form Handling
$_GET[] - contains variables from the URL$_POST[] - contains variables submitted through forms with method = post$_REQUEST[] - combines the values of both get/post arrays. This is generally considered a less secure way to access the content, as your form should be designed for one submission type or the other, not both.
MySQL- how to connect from PHP
$hostnameORip = ""; $databaseName = ""; $username = ""; $password = ""; $connectionString = "mysql:host=".$hostnameORip.";dbname=".$databaseName.";"; try{ $db = new PDO($connectionString, $username, $password); }catch(Exception $e){ echo "<pre>".print_r($e, true)."</pre>"; //this should give you any errors that occurred trying to connect to the database}
CSS- Sizing content
% - percentage px - pixel em - relative to font size
JS- Comments
/* comment here */
CSS- Comments
/* comments go here */
PHP- Comments
// single line comment /* multi-line comment */ # rarely used alternate single line comment
CSS- Where to apply CSS
1. inline - This is done on the individual HTML tag through the "style" attribute 2. internal - This is done as a block of CSS included on the page somewhere inside of <style></style> tags 3. external - This is when we put the CSS in a different file. This is the preferred method for most styles, because it allows us to share the styles over several pages instead of having to manually put the same styles everywhere
Bootstrap- Basics
12 space grid Using the class "col" on several consecutive elements in a row will cause them to equally divide the space up to 12ths break point size: xs, sm, md, lg, xl
HTML- Comments
<!-- comment goes here -->
HTML- Structure
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body ><h1>My First Heading</h1> <p>My first paragraph.</p></body> </html>
Responsive Design- Primary CSS tool for achieving responsive design
@media???
jQuery- What is a CDN?
A content delivery network, or content distribution network, is a geographically distributed network of proxy servers and their data centers.
jQuery- Selectors
All Selector ("*") $(#mydivid .mydivclass table")
CSS- versions
CSS3
CSS- Acronyms
Cascading Style Sheets
PHP- Functions
Common Functions- explode / implode - converts a string to an array or an array to a string. str_replace / str_ireplace - string replace and string replace that is case insensitive strlen - string length
HTML- Common HTML Tags
Container Tag: p>your text/content goes here</p> <div> </div> Special Case Tag: <br/> <hr/>
CSS- Colors and how they are set
FFFFFF color:green;
MySQL- Syntax for basic query types
Get: SELECT * FROM table WHERE condition Put: INSERT INTO table (column1, column2) VALUES (value1, value2) Update: UPDATE table SET column1 = value1 WHERE condition Delete: DELETE FROM table WHERE condition
HTML- Versions
HTML 5
HTML- Acronyms
HTML hypertext markup language
HTML- Syntax
HTML uses tags for its syntax
PHP- Acronyms
Hypertext Preprocessor Originally stood for: "Personal Home Page"
JS- acronym
Javascript
PHP- Syntax
Object oriented! Code Block- <?php ?>
PHP- What is PHP used for
PHP is a server side scripting language. that is used to develop Static websites or Dynamic websites or Web applications
PHP- Where does PHP run?
PHP runs on the web Server
MySQL- acronyms
Structured Query Language
Responsive Design- Goals
The goal of making our content responsive, is to ensure it can be consumed by the widest audience possible.
JS- Syntax
The syntax of JavaScript is the set of rules that define a correctly structured JavaScript program
PHP- Basic function call
Variables- $var = "Hello World"; Functions- function myFunc($v){ return false;}
CSS- selectors
basic selectors: tag name, class, id Advanced CSS selector: there is a very large number of advanced selectors. These advanced selectors are generally combinations of multiple selectors Ex: div table - selects tables that are inside of div tag, space = contains
PHP- foreach loop
foreach (iterable_expression as $value) statement foreach (iterable_expression as $key => $value) statement
HTML- attributes
href, src, width, style, etc
jQuery- What is Jquery
jQuery is a JavaScript library designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax.
jQuery- Syntax
jQuery() OR $()
JS- Where does js run?
most often run on webpages inside the browser, but it can also be run server-side.
PHP- Unix Timestamp
the number of seconds since Jan 1, 1970 in UTC. The function "time()" returns the current unix timestamp