Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizards Guide to PHP by David Lash.
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.
Day 3 - Basics of MySQL What is MySQL What is MySQL How to make basic tables How to make basic tables Simple MySQL commands. Simple MySQL commands.
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
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.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
Deleting and Updating Records in MySQL using PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
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.
Slide 8-1 CHAPTER 8 Using Databases with PHP Scripts: Using MySQL Database with PHP.
INTERNET APPLICATION DEVELOPMENT For More visit:
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
Dbwebsites 2.1 Making Database backed Websites Session 2 The SQL… Where do we put the data?
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
MySQL. MySQL is a Relational Database Management System (RDBMS) that runs as a server providing multiuser access to a number of databases. A third party.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CSC 2720 Building Web Applications Database and SQL.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
>> Introduction to MySQL. Introduction Structured Query Language (SQL) – Standard Database Language – Manage Data in a DBMS (Database Management System)
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
There are two types of MySQL instructions (Data Definition Language) DDL: Create database, create table, alter table,,,. (Data Manipulation Language) DML.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Introduction to MySQL Ullman Chapter 4. Introduction MySQL most popular open-source database application Is commonly used with PHP We will learn basics.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
Databases.
Chapter 5 Introduction to SQL.
CS320 Web and Internet Programming SQL and MySQL
Open Source Server Side Scripting Permissions & Users
CS1222 Using Relational Databases and SQL
Chapter 7 Working with Databases and MySQL
Chapter 8 Working with Databases and MySQL
CS1222 Using Relational Databases and SQL
CS122 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS3220 Web and Internet Programming SQL and MySQL
CS1222 Using Relational Databases and SQL
Chapter 4 Introduction to MySQL.
MySQL Database System Installation Overview SQL summary
CS3220 Web and Internet Programming SQL and MySQL
CS1222 Using Relational Databases and SQL
CS122 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
Presentation transcript:

Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu

What is Database? A database is a collection of tables (made up of columns and rows) that stores information.

What is MySQL? The most used relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases Most databases are created, updated, and read using SQL (Structured Query Language)

Cf)Data Interchange Formats JSON {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }} XML

PHP & mySQL

Our Shared DB Host:ipower.com username: interactive password: 11bestoftimes_2012 Jean’s Host:data.jeanhochu.com username: tcnj password: dynamicweb This will only allow you to log in to the control panel but will not give you remote access This will not allow you to the control panel but will give you remote access

Host : ipower.com

Code General $dbc 'username', 'password') Remote Connnect $dbc hochu.com', 'tcnj', 'dynamicweb') * note: Tcnjart.com ipower account setting do not support remote access to the database. You could only use the control panel or use Jean’s personal database connection.

SELECT ( Retrieves records from a table ) INSERT ( Adds records to a table ) UPDATE ( Updates records in a table ) DELETE ( Deletes records from a table ) Common SQL Commands

MySQL Database

Add Database

Create Database mysql_query('CREATE DATABASE somedb', $dbc); Theoretically, it should work, but it won’t work in Jean’s server for permissions and security reasons.

Manage Database

php MyAdmin

Create Table CREATE TABLE tablename (column1 definition, column2 definition)

Create Table CREATE TABLE entries ( entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR(100) NOT NULL, entry TEXT NOT NULL, date_entered DATETIME NOT NULL); Table name Column Definition Datatype

Common Datatypes INTused for IDs VARCHARused for varying lengths (255 or less) CHARused for fixed lengths TEXTused to store lots of text like blog entries DATETIMEused for storing dates

Primary Key Every table should have one. It should contain a value. That value must never change. It must be unique for each record in the table.

auto_increment If you add 'AUTO_INCREMENT' into the column description, it will assign the next-highest number available for the columns value.

Table Created! click

Table Created!

SELECT * FROM `entries` SELECT * FROM `entries` WHERE `entry_id` = '2' LIMIT 0, 30 SELECT * FROM ‘entries’ ORDER BY ‘entry_id’ * asterisk is the equivalent of saying every column

Inserting Rows INSERT INTO tablename VALUES (value1, value2, value3) INSERT INTO tablename (column1_name, column2_name) VALUES (value1, value2)

Inserting Rows INSERT INTO entries (entry_id, title, entry, date_entered) VALUES (0, '$title', '$entry', NOW())

Row Inserted!

Updating Rows UPDATE tablename SET column1_name= value, column2_name=value2 WHERE some_column=value

Row Updated!

Deleting Rows DELETE FROM tablename WHERE column=value

Deleting Rows

References PHP for the Web (Larry Ullman) : Chapter 12