Shared Flashcard Set

Details

PHP
PHP, Apache, Mysql Web Development
16
Computer Science
Graduate
05/20/2013

Additional Computer Science Flashcards

 


 

Cards

Term
$connect = mysql_connect("127.0.0.1", "root", "") or die ("Hey loser, check your server connection.");
Definition
connect mysql with hostname,username, password or die mean it display message - "Hey loser, check your server connection."
Term
mysql_create_db("wiley")
or die(mysql_error());
Definition
mysql create a database name "wiley" or die display a message -"mysql error"
Term
mysql_select_db ("wiley");
Definition
mysql select a database to display name "wiley"
Term
$movie = "CREATE TABLE movie (
movie_id int(11) NOT NULL auto_increment,
movie_name varchar(255) NOT NULL,
movie_type tinyint(2) NOT NULL default 0,
movie_year int(4) NOT NULL default 0,
movie_leadactor int(11) NOT NULL default 0,
movie_director int(11) NOT NULL default 0,
PRIMARY KEY (movie_id),
KEY movie_type (movie_type,movie_year)
) TYPE=MyISAM AUTO_INCREMENT=4 ";
Definition
-create a movie table with different column requirements and "TYPE" is the type of database format that is being use.

-on page 93 about different type of database.

-another way to create a table, everything between "$movie=" and "Type" can be put in myphpadmin SQL
Term
$results = mysql_query($movie)
or die (mysql_error());
Definition
-send commands back to the myphpadmin server, or die display message

-in this it sending the "$movie" to the myphpadmin server and display a message of "mysql_error()"
Term
session_start();
$_SESSION['username']=$_POST['user'];
$_SESSION['userpass']=$_POST['pass'];
$_SESSION['authuser']=0;

//Check username and password information

if (($_SESSION['username']== 'Joe') AND
($_SESSION['userpass']== '12345'))
{
$_SESSION['authuser']=1;
}
else
{
echo "Sorry, but you don't have permission to view this page, you
loser!";
exit();
}
?>
Definition
-Start login session that is on a different page from the login page that give u a 0
as authuser until u give it the correct username and password, it give u a 1 as authuser

- in this one giving the incorrect password it will echo "Sorry, but you don't have permission to view this page, you loser!"

-this example is not connect to a database
Term
Please Log In
Definition
-login page with a session_unset

-session_unset just clears out the sesison for usage

-session_unset is a much more effective means of actually clearing out data.
Term
Alernates to the php tags
Definition
- this must be turn on in your php.ini file with the short open tag configuration.

-<% %> this must be turn on in your php.ini file with the ASP tags configuration.

-script- language="php" -script- these are available without changing your php.ini

the- - on script are < >, flashcardmachine don't allow that tag on a flash card
Term
"&&" or "AND"
Definition
alternative that Can be use in place of "AND" logical operators
Term
"||" or "or"
Definition
alternative that Can be use in place of "or" logical operators
Term
$value=$value+

or

$value++

-----------------------------------------------

//example for using this


$values=$values+1

echo "$values"


?>
Definition
alternates to incrementing values
Term
Definition
-the just include another php function file without have to type a long file over and over, in this one we use the a time function in each pages of the website to be displayed. -you can use for login function on different pages
Term
$insert="INSERT INTO movie (movie_id, movie_name, movie_type, movie_year,
movie_leadactor, movie_director)
VALUES (1, 'Bruce Almighty', 5, 2003, 1, 2),
(2, 'Office Space', 5, 1999, 5, 6),
(3, 'Grand Canyon', 2, 1991, 4, 3)";

-------------------------------------
$results = mysql_query($insert)
or die(mysql_error());
Definition
-insert data in different columns of the movies table

- the column are: movie_id, movie_name, movie_type, movie_year, movie_leadactor, movie_director

the value that are being inserted are :(1, 'Bruce Almighty', 5, 2003, 1, 2),
(2, 'Office Space', 5, 1999, 5, 6),
(3, 'Grand Canyon', 2, 1991, 4, 3)";

-$result send it this command to myphpadmin
Term
//this example show how to select data from the database and display it 1990 ORDER BY movie_type"; $results=mysql_query($query) or die(mysql_error()); while ($rows=mysql_fetch_array($results)) { extract($rows); echo $movie_name; echo " - "; echo $movie_type; echo "
"; } ?>
Definition
-in this example it connect to the database

-and select the database it want

-then select want table and columns it want from that database

- then send the command to the myphpadmin

-then it put it in a array to seperate the info with there own string and echo them out
Term
echo $_REQUEST['favmovie']
Definition
pulls a variable from a different page side to be echo
Term
if (ISSET($_REQUEST['favmovie'])) { echo "Welcome to our site, "; echo $_SESSION['username']; echo "!
"; echo "My favorite movie is "; echo $_REQUEST['favmovie']; echo "
"; $movierate=5; echo "My movie rating for this movie is: "; echo $movierate; }
Definition
-IF(ISSET set the famovie to be echo on the site once u click the link

- then echo username

-then echo "My favorite movie is"

- then echo "favmovie"

-then give it a constant of "5"

-then echo "My movie rating for this movie is"

-then echo "5"
Supporting users have an ad free experience!