Lesson-05-PHP-Working-with-Databases-in-PHP
Lesson-05-PHP-Working-with-Databases-in-PHP
ADVANCED WEB
PROGRAMMING
Unit 6:
Working with
Databases in PHP
PHP Functions
<?php
function functionName($argument1, $argument2...) {
// code to be executed
}
<?php
function showGreeting() {
echo "Hello Gon, Luffy, and Killua!";
}
showGreeting();
?>
Output:
greetPerson(“Gon Freecss");
greetPerson(“Killua Zoldyck");
?>
Output:
<?php
function difference($a, $b) {
$c = $a - $b;
return $c;
}
The
syntax for
connecting to a
MySQL
database:
Considering your entered information
is correct, you’d be successfully connected
to the right database and ready to start
writing and testing your queries.
Otherwise, the respective error message
would appear as defined by the die
function.
Connecting to MySQLi
Databases (Procedural)
"localhost/phpmyadmin"
Step by Step Process