Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 9 Using PHP with MySQL.

Similar presentations


Presentation on theme: "Chapter 9 Using PHP with MySQL."— Presentation transcript:

1 Chapter 9 Using PHP with MySQL

2 header.html Script 9.1 on page 266
ch09\includes\header.html

3 mysqli_connect.php Script 9.2 on page 269
ch09\mysqli_connect.php

4 Invalid Password Could not connect to MySQL: Access denied for user (using password: YES)

5 Access Information // Set the database access information as constants: DEFINE ('DB_USER', 'frank'); DEFINE ('DB_PASSWORD', '); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'db_frank');

6 mysqli_connect $dbc (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );

7 Protecting Connection Information
Page 270 Figure B Store connection information outside of (htdocs folder) Use .php extension

8 sql.sql Use only Chapter 5

9 users table mysql -h csweb.hh.nku.edu -u frank -p <sql.sql
mysql> use db_fall17_frank; Database changed mysql> show tables; mysql> select * from users;

10 register.php Script 9.3 on page 275
ch09\script_09_03\register.php

11 Running MySQL Query // Make the query: $q = "INSERT INTO users (first_name, last_name, , pass, registration_date) VALUES ('$fn', '$ln', '$e', SHA1('$p'), NOW() )"; // Run the query. $r ($dbc, $q); if ($r) { // If it ran OK.


Download ppt "Chapter 9 Using PHP with MySQL."

Similar presentations


Ads by Google