MySQL Database Connection

Slides:



Advertisements
Similar presentations
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Advertisements

PHP and MySQL Database. Connecting to MySQL Note: you need to make sure that you have MySQL software properly installed on your computer before you attempt.
Virtual training week 4 structured query language (SQL)
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
MySQL and PHP By Trevor Adams.
Training on Koha ILS organized by BALID Institute of Information Management 3-7 September Basic of MySQL Prepared by Nur Ahammad Junior Assistant Librarian.
What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables. A table is a collections of related data entries and.
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
Polling System Part 1 Creating PHP & MySQL Files CIS 254.
Lecture 10 – MYSQL and PHP (Part 2)
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Quick review of SQL And conversion to Oracle SQL.
Pengantar Teknologi Internet W14: Server Scripting & Database.
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
MySQL Database Management Systems Universitas Muhammadiyah Surakarta Yogiek Indra Kurniawan.
Roles & privileges privilege A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
PHP Database Processing CIS 1715 Web Technologies.
SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Access The L Line The Express Line to Learning 2007 L Line L © Wiley Publishing All Rights Reserved.
Introduction to Oracle In June 1970,Dr E.F.Codd’s a published A paper entitled A relational model of Data for large shared data banks. This relational.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
Database Programming Sections 14– database transactions and controlling User Access.
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
Database MySQL Universitas Muhammadiyah Surakarta Yogiek Indra Kurniawan.
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
1 Announcements Reading for next week: Chapter 4 Your first homework will be assigned as soon as your database accounts have been set up.  Expect an .
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Chapter 13Introduction to Oracle9i: SQL1 Chapter 13 User Creation and Management.
Oracle 11g: SQL Chapter 7 User Creation and Management.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
Relational Database Management System(RDBMS) Structured Query Language(SQL)
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
PHP with MYSQL Please use speaker notes for additional information!
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
 CONACT UC:  Magnific training   
MY SQL INTRODUCTION TO LOGIN BASIC COMMANDS OTHER COMMANDS.
SQL Structured Query Language. SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database.
Database Languages.
DCL – Data Control Language
PGT(CS) ,KV JHAGRAKHAND
Oracle & SQL Introduction
Introduction To Database Systems
SQL 101.
DATABASE MANAGEMENT SYSTEM
Chapter 8 Working with Databases and MySQL
The Basics of Data Manipulation
Data Control Language Grant, Revoke.
مقدمة في قواعد البيانات
SQL Fundamentals in Three Hours
SQL Queries Chapter No 3.
Accessing Your MySQL Database from the Web with PHP (Ch 11)
HAVING,INDEX,COMMIT & ROLLBACK
SQL .. An overview lecture3.
PHP AND MYSQL.
Database SQL.
Lecuter-1.
Presentation transcript:

MySQL Database Connection Pemrograman Web MySQL Database Connection

Basic SQL Syntax Data Definition Language  used to define the database structure or schema CREATE create objects in the database ALTER alters the structure of the database DROP delete objects from the database TRUNCATE remove all records from a table, including all spaces allocated for the records are removed

Basic SQL Syntax (2) Data Manipulation Language used for managing data within schema objects SELECT Retrieve data from the database INSERT Insert data into a table UPDATE Updates existsing data within a table DELETE Deletes records from a table

Basic SQL Syntax (3) Data Control Language Used to control data access authority in database GRANT gives user's access privileges to database REVOKE withdraw access privileges given with the GRANT command

Basic SQL Syntax (4) Transaction Control Language used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions COMMIT save work done ROLLBACK  restore database to original since the last COMMIT

MySQL Database Connection in PHP Requirements: The database server IP Address / UNIX socket name Username and password Database name <?php $link = mysql_connect('localhost', ‘user', ‘password'); if (!$link) {     die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?>

Selecting a MySQL Database <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('foo', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); ?>

Executing a Query <?php ?> $sql = 'SELECT * FROM table_name'; // or $sql = 'INSERT INTO table_name (col_name) VALUES ('value'); $sql = 'UPDATE table_name SET col_name = 'new_value'; $sql .= 'WHERE col_name = 'old_value'; $result = mysql_query( $sql ); if (!$result) { die('Invalid query: ' . mysql_error()); } ?>