Home
Flashcards
Preview
MySQL1 Database Connections (8)
Home
Get App
Take Quiz
Create
function to convert the ' so that it doesn't mess up the code
addlashes()
2 steps to make a query, including
1. Make a variable with the query
2. create a variable that pulls the first variables result using mysql_query()
$command = "SELECT * FROM friends;";
echo "Command
: ".$command."<br>";
$result = mysql_query($command);
Function to pull data from a queried variable
mysql_fetch_object()
$data = mysql_fetch_object($result)
What approach would you use to get data out of a queried variable
while ($data = mysql_fetch_object($result)) {
echo $data->first_name
}
Two steps to connect to a database
1. Create a variable with mysql_connect(host, user, pw)
2. Call that variable with a new variable using myql_select_db($database, $db);
What function stores the host, user, and password?
mysql_connect($host, $user, $pw)
Function to select a database
mysql_select_db($database, $db)
function that works as a backup if the login function fails
or die()
End a session
mysql_close($database)
Insert something into the database
$variable = mysql_query(insert into...);
Author
dalbabes
ID
102733
Card Set
MySQL1 Database Connections (8)
Description
PHP class
Updated
2012-07-26T15:36:51Z
Show Answers
Home
Flashcards
Preview