1 / 11

PHP-language, database-programming

PHP-language, database-programming. Teppo Räisänen Oulu University of Applied Sciences School of Business and Information Management. Idea of database programming. End users do not use database from management console using SQL-statements

childersc
Download Presentation

PHP-language, database-programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP-language, database-programming Teppo Räisänen Oulu University of Applied Sciences School of Business and Information Management

  2. Idea of database programming • End users do not use database from management console using SQL-statements • Create UI (web-page, windows form, etc.) for end user and permorm database manipulation in application code (e. g. in PHP-script)

  3. Database programming Application Database-programming API (Application programming interface) Database-driver

  4. Basic steps of database programming • Open connection to database-server and Select database • Manipulate data • Close connection

  5. Example: Read data from database

  6. mysql_fetch_row Structure of the table in database Data (records) of the table in database mysql_fetch_row read one record at time and the return value is array containing information of all fields

  7. Example: Insert data into database newMessage.html save.php

  8. Opening connection • Connection to database server must be opened before manipulating data • Check always for error when opening database connections

  9. Select database to use • Select database to use • Servers may have several different databases

  10. Manipulate data • Reading information • mysql_query containing select sql-statement • mysql_fetch_row inside while loop • Inserting, updating and deleting • mysql_query containing sql-statement that manipulates data

  11. Close connection • Connection to database (server) must be always closed after manipulatin data • Open connections consumes resources from server

More Related