Mysql is your database. It can move data
with the help of a little php, html and mysql queries.
The Mysql query is composed of a connection script and a query
which is either inserting, modifying, or deleting data then returning
the result in a nice table.
The Mysqli Connection script &
PDO Connection script contain:
Database name, Username & password, and an error message (if error found)
sent back to the user such as "error not connected".
Mysql
Mysql Rules
Usage
Mysql Basics
Create Database
CREATE DATABASE databasename;
A structure that allows us to identify and access data
in relation to another piece of data in the database..
Here we insert data into the students table.
The column names match the
variable names to insure correct insertion. Data types [S = string, other
choices are i = integer or b=blob(large amount of data)]. The question marks represent
the data to be inserted.
PDO Prepared Statements
PDO
PDO More versitile than Mysqli.
PDO connects to many different db without additional driver downloads.
Mysqli
can enter arrays into db using foreach loops.
PDO can insert arrays directly into db.
PDO Named parameters
I know kung fu
$qry = "select * from customers where
first_name = :fname and last_name=:lname";
$statement = $db->prepare($qry);
$statement->bindParam(':fname',$firstName);
$statement->bindParam(':lname',$lastName);
$firstName = 'Mikey';
$lastName = 'Ginnelly';
$statement->execute();
$rowsAssoc = $statement->fetch(PDO::FETCH_ASSOC);
print_r($rowsAssoc);
the table name (students) and column names
(:fname and :lname) are preceded by a colon(:)
the actual data in the example
followed by (=>)
then entered into database using execute.
The table [customers] is selected
and all data from columns (fname & lname)
is displayed in rows which have 'Mikey' in fname column and 'Ginnelly' in lname column.