Join Bill Weinman for an in-depth discussion in this video Managing the database in PHP, part of PostgreSQL 9 with PHP Essential Training.
In this movie we're going to look at the code for the testimonials database…management function.…In your Exercise Files you find this under the Testimonials folder and in db.php.…This is actually a pretty straightforward piece of code.…At the top of the code here you'll find some constants are defined and we are…also, including the bwPgSQL.php library.…So this definitely does use that library and you can see how using a library…like this makes the code quite a bit cleaner and easier to code.…
So you'll notice here in the init function I instantiate a new bwPgSQL object…and there is a little jump function here that makes managing the state of the…web connection quite a bit easier based on an action variable, whether to add,…edit, update, delete.…So that makes that all pretty easy.…So adding an item is simply a matter of running some PHP escapes on it to make…sure that it's safe and then calling db insert.…
And if there is an error I catch it with the PDOException, and display the error message.…
- Installing PostgreSQL
- Understanding database architecture
- Inserting, updating, and deleting data in a table
- Creating a database library
- Indexing ID fields
- Storing numbers, text, and Boolean values
- Reading data
- Using casts to force type
- Using mathematical functions
- Concatenating strings
- Working with date and time functions and operators
- Defining CRUD
- Using PHP to insert, read, update, and delete rows in a database
Skill Level Beginner
1. Quick Start
2. Creating a Database
3. Data Types
4. Storing and Reading Data
5. SQL Expressions
6. Mathematical Functions and Operators
Using math functions3m 2s
7. String Functions and Operators
8. Date and Time Functions and Operators
9. PHP Interfaces
10. Web Applications
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.