Lab 7 Introduction to MySQL

Size: px
Start display at page:

Download "Lab 7 Introduction to MySQL"

Transcription

1 Lab 7 Introduction to MySQL Objectives: During this lab session, you will - Learn how to access the MySQL Server - Get hand-on experience on data manipulation and some PHP-to-MySQL technique that is often required for developing a E-Business website - Exercise on Page 5 and 12 Laboratory Practice: Use MySQL Query Browser to Access the MySQL Server A. You can download the MySQL query browser at the following. MySQL Query Browser allows you to execute SQL commands for manipulating tables and records. MySQL official web site: B. You can find the MySQL query in our lab machine as shown in following. MySQL Query Browser is available from nalwin32 in our LAB PC. It is located under "COMP" -> "Network Application Packages" -> "Database" -> "MySQL" -> "MySQLQBrowser" Page: 1

2 C. Please use/type the following information to login your account: a. Server Host: mysql.comp.polyu.edu.hk b. Port: 3306 c. Username: <Your student ID> d. Password:<MySQL Password> e. Default Schema: <Your student ID> D. Press OK to connect to the database. Working with some basic SQL statements E. Use/Copy the following SQL query and paste it into the tab named Resultset 1 in MySQL Query Browser, and press Execute to create a table. CREATE TABLE students ( id int(5) NOT NULL auto_increment, student_id text NOT NULL, name text NOT NULL, gender char(1) NOT NULL, major text NOT NULL, nationality text NOT NULL, active tinyint(1) NOT NULL default '1', create_date datetime NOT NULL default ' :00:00', last_update_date datetime NOT NULL default ' :00:00', PRIMARY KEY (id) ) Engine = innodb; i. Next, use/copy the following query and press Execute to add three new records in the table. insert into students (student_id, name, gender, major, nationality) values ('S0001', 'Peter', 'M', 'CS', 'Chinese'); insert into students (student_id, name, gender, major, nationality) values ('S0002', 'Mary', 'F', 'BA', 'Chinese'); insert into students (student_id, name, gender, major, nationality) values ('S0003', 'Paul', 'M', 'EIE', 'Chinese'); Page: 2

3 ii. To see all the records in the table, you can go back to Resultset 1 tab and type the following query SELECT * FROM students; iii. To view the records only if the students are taking major in BA SELECT * FROM students WHERE major= BA ; iv. To view the whole student list with sorted order in student ID SELECT * FROM students ORDER BY student_id ASC; SELECT * FROM students ORDER BY student_id DESC; v. To update the information for particular record UPDATE students SET gender= F where student_id= S0001 ; SELECT * FROM students; vi. To delete a particular record, type the following query DELETE FROM students WHERE student_id= S0003 ; SELECT * FROM students; PHP to MySQL 1. Now, we have to create a PHP page to access the data stored in COMP MySQL database. The following PHP page retrieve records from students table in the MySQL database server, and list all records in HTML table form. Please rename the file as display_comp.php and perform the testing. <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>display Page</title> </head> <body> <h1>display Page</h1> <table width="400" border="0" cellspacing="0" cellpadding="0"> <p> </p> mysql_connect("mysql.comp.polyu.edu.hk","your Login","Your Password"); mysql_select_db("your db (Student ID)"); $result=mysql_query("select * from students"); while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>"; echo $row[1]; echo "</td><td>"; echo $row[2]; echo "</td><td>"; echo $row[3]; echo "</td><td>"; Page: 3

4 echo $row[4]; echo "</td><td>"; echo $row[5]; echo "</td></tr>"; mysql_free_result($result); </table> </body> </html> 2. Now, we will create a HTML form to add a new student record. create_comp.php Insert_comp.php MySQL <html xmlns=" <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>create Page</title> </head> <body> <h1>create Page</h1> <form id="form1" name="form1" method="get" action="insert_comp.php"> { echo "ID : <input name=stid type=text id=stid></input><br>"; echo "Name :<input name=stname type=text id=stname></input></br>"; echo "Sex : <input name=stsex type=text id=stsex></input></br>"; echo "Major : <input name=stmajor type=text id=stmajor></input></br>"; echo "Nationality : <input name=stnationality type=text id=stnationality></input></br>"; <input type="submit" name="create" id="create" value="create" /> </form> </body> </html> Page: 4

5 3. Then, we create PHP with insert statement. <title>insert</title> $stid=$_get["stid"]; $stname=$_get["stname"]; $stsex=$_get["stsex"]; $stmajor=$_get["stmajor"]; $stnationality=$_get["stnationality"]; mysql_connect("mysql.comp.polyu.edu.hk","your Student ID","Your Password"); mysql_select_db("your Database (Student ID)"); $sql="insert into students (student_id, name, gender, major, nationality) values ('$stid', '$stname', '$stsex', '$stmajor', '$stnationality')"; mysql_query($sql); Exercise 1. You are required to create a search.html, edit.php and update.php as shown in the following figure. search.html is used to capture the student id. edit.php is used to display the current information. update.php is used to stored the data to the DB. serch.html edit.php update.php MySQL Page: 5

6 Objective After this lab session, you will - Learn how to access the MySQL Server - Learn the basic syntax of SQL query - Get hand-on experience on PHP session handling - Get hand-on experience on data manipulation and some PHP-to-MySQL techniques Laboratory Use with MySQL in XAMPP I. Run XAMPP II. Go to Admin page in MySQL as shown III. MySQL default setting is shown as follows a. Server Host: b. Port: 3306 c. Username: root d. Password: <no password > e. Default Schema: root Page: 6

7 IV. To modify the default, please click Privileges Page V. In COMP server, you can create multiple tables but there is only one database (The database name is your student id). VI. You can create multiple databases in your server. To create new database, please click Database Page. Page: 7

8 1. User Registration with MySQL VII. Create a table named users. If you are using XAMPP, please also create a DB (comp3421) to store the table. The table is used for storing user information. The following is the DDL statement to create the table Create table users ( username varchar(15) primary key, fullname text not null, password varchar(15) not null, varchar(50) not null); VIII. Create a PHP user registration page named register.php with the following code. The user information will be stored in the MySQL database. session_start(); <html><head><style> h1 {color:red </style></head> <body> $username = $_POST['username']; $fullname = $_POST['fullname']; $password = $_POST['password']; $ = $_POST[' ']; function insertrecord($username, $fullname, $password, $ ) { $conn = mysql_connect("localhost", "root", ""); mysql_selectdb("comp3421", $conn); $query = "insert into users values ('". $username. "', '". $fullname. "', '". $password. "', '". $ . "')"; mysql_query($query, $conn); if (mysql_error()!= "") { echo "<h1>the user name is already used by another user. ". " Please use another one.</h1>"; echo "<input type=\"button\" ". " onclick=\"javascript: history.go(-1)\" value=\"back\"/>"; else { $_SESSION['conn'] = $conn; Page: 8

9 $_SESSION['username'] = $username; $_SESSION['fullname'] = $fullname; echo "<h1>registration is completed successfully</h1>"; mysql_close($conn); if (isset($username) && trim($username)!= "") { insertrecord(trim($username), trim($fullname), trim($password), trim($ )); else { <form action=" echo $_SERVER['PHP_SELF']; " method="post"> User name: <input type="text" name="username" /><br/> Full Name: <input type="text" name="fullname" /><br/> Password: <input type="password" name="password" /><br/> <input type="text" name=" " /><br/> <input type="submit" value="sign In" /><br/> </form> </body></html> IX. Update the following lines with your MySQL account information: $conn = mysql_connect("localhost", "root", ""); mysql_selectdb("comp3421", $conn); X. Upload the PHP page to the web server and see the result in the browser 2. Login with MySQL I. Create a PHP user login page named login.php with the following code. The page retrieves user name and password from the MySQL database and does the login checking. session_start(); function printloginform() { <form action=" echo $_SERVER['PHP_SELF']; " method="post"> <h1>system Login</h1> User name: <input type="text" name="username" /><br/> Password: <input type="password" name="password" /><br/> <input type="submit" /> Page: 9

10 </form> function printwelcomescreen($name) { echo "<h1>welcome, $name</h1>"; echo "<a href=\"edit_user.php\">edit Personal Information</a><br/>"; echo "<a href=\"logout.php\">logout</a>"; if (isset($_session['username'])) { $username = $_SESSION['username']; $fullname = $_SESSION['fullname']; printwelcomescreen($fullname); die(); if (!isset($_post['username'])!isset($_post['password'])) { printloginform(); die(); $username = $_POST['username']; $password = $_POST['password']; $conn = mysql_connect("localhost", "root", ""); mysql_select_db("comp3421", $conn); $query = "select fullname from users ". "where username='$username' and password='$password'"; $resultset = mysql_query($query, $conn); if (mysql_num_rows($resultset) > 0) { $record = mysql_fetch_row($resultset); $_SESSION['username'] = $username; $_SESSION['fullname'] = $record[0]; printwelcomescreen($record[0]); else { printloginform(); mysql_close($conn); II. Update the following lines with your MySQL account information: $conn = mysql_connect("localhost", "root", ""); mysql_selectdb("comp3421", $conn); Page: 10

11 III. Upload the PHP page to the web server and see the result in the browser 3. Logout Page I. Create a PHP logout page named logout.php with the following code. session_start(); if (isset($_session['username'])) { echo "<h1>good bye, ". $_SESSION['fullname']. "</h1>"; echo "<a href=\"login.php\">login</a>"; unset($_session['username']); unset($_session['fullname']); else { echo "<h1>you have not logged in yet</h1>"; echo "<a href=\"login.php\">login</a>"; II. Upload the PHP page to the web server and see the result in the browser 4. Exercise I. Create a PHP page named edit_user.php. The page is used for updating personal information. You need to complete the page using the following code. session_start(); function printeditform($name) { <form action=" echo $_SERVER['PHP_SELF']; " method="post"> <h1>personal Info Update</h1> <h3> echo $name; </h3> Full name: <input type="text" name="fullname" /><br/> Password: <input type="password" name="password" /><br/> <input type="text" name=" " /><br/> <input type="submit" name="submit" /> </form> Page: 11

12 if (!isset($_session['username'])) { echo "<h1>you have not logged in yet</h1>"; echo "<a href=\"login.php\">login</a>"; die(); if (isset($_post['submit'])) { $username = $_SESSION['username']; $_SESSION['fullname'] = $fullname = $_POST['fullname']; $password = $_POST['password']; $ = $_POST[' ']; else { // Add your code here to complete this PHP page printeditform($_session['fullname']); II. III. Update the following lines with your MySQL account information: $conn = mysql_connect("localhost", "root", ""); mysql_selectdb("comp3421", $conn); Upload the PHP page to the web server and see the result in the browser ~ End ~ Page: 12

By the end of this section of the practical, the students should be able to:

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Connecting to a MySQL database in PHP with the mysql_connect() and mysql_select_db() functions Trapping and displaying database

More information

ITS331 IT Laboratory I: (Laboratory #11) Session Handling

ITS331 IT Laboratory I: (Laboratory #11) Session Handling School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS331 Information Technology Laboratory I Laboratory #11: Session Handling Creating

More information

home.php 1/1 lectures/6/src/ include.php 1/1 lectures/6/src/

home.php 1/1 lectures/6/src/ include.php 1/1 lectures/6/src/ home.php 1/1 3: * home.php 5: * A simple home page for these login demos. 6: * David J. Malan 8: * Computer Science E-75 9: * Harvard Extension School 10: */ 11: // enable sessions 13: session_start();

More information

Database Connectivity using PHP Some Points to Remember:

Database Connectivity using PHP Some Points to Remember: Database Connectivity using PHP Some Points to Remember: 1. PHP has a boolean datatype which can have 2 values: true or false. However, in PHP, the number 0 (zero) is also considered as equivalent to False.

More information

WEB PROGRAMMING SCV1223. PHP : Authentication Example. Dr. Md Sah bin Hj Salam En. Jumail bin Taliba

WEB PROGRAMMING SCV1223. PHP : Authentication Example. Dr. Md Sah bin Hj Salam En. Jumail bin Taliba WEB PROGRAMMING SCV1223 PHP : Authentication Example Dr. Md Sah bin Hj Salam En. Jumail bin Taliba Topics Form Handling Redirection Connecting to Database User Authentication Session Authentication Case

More information

PHP Tutorial 6(a) Using PHP with MySQL

PHP Tutorial 6(a) Using PHP with MySQL Objectives After completing this tutorial, the student should have learned; The basic in calling MySQL from PHP How to display data from MySQL using PHP How to insert data into MySQL using PHP Faculty

More information

COM1004 Web and Internet Technology

COM1004 Web and Internet Technology COM1004 Web and Internet Technology When a user submits a web form, how do we save the information to a database? How do we retrieve that data later? ID NAME EMAIL MESSAGE TIMESTAMP 1 Mike mike@dcs Hi

More information

Introductory workshop on PHP-MySQL

Introductory workshop on PHP-MySQL Introductory workshop on PHP-MySQL Welcome to Global Certifications and Training from Rocky Sir Download all needed s/w from monster.suven.net Full Stack development : UI + Server Side 1 or more client

More information

COMP519: Web Programming Autumn 2015

COMP519: Web Programming Autumn 2015 COMP519: Web Programming Autumn 2015 In the next lectures you will learn What is SQL How to access mysql database How to create a basic mysql database How to use some basic queries How to use PHP and mysql

More information

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to:

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to: LAMP Apps Overview This lab walks you through using Linux, Apache, MySQL and PHP (LAMP) to create simple, yet very powerful PHP applications connected to a MySQL database. For developers using Windows,

More information

Lecture 6 Session Control and User Authentication. INLS 760 Web Databases Spring 2013 Rob Capra

Lecture 6 Session Control and User Authentication. INLS 760 Web Databases Spring 2013 Rob Capra Lecture 6 Session Control and User Authentication INLS 760 Web Databases Spring 2013 Rob Capra HTML Forms and PHP PHP: lect2/form1.php echo "Hello, ". htmlspecialchars(strip_tags($_get['name'])); echo

More information

Enter Grade Report. No Place Like Gilbert Duenas. California State University San Marcos. Johnny Koons. CS 441 Software Engineering

Enter Grade Report. No Place Like Gilbert Duenas. California State University San Marcos. Johnny Koons. CS 441 Software Engineering Enter Grade Report No Place Like 192.168.0.1 Gilbert Duenas Johnny Koons Russell Hathaway California State University San Marcos CS 441 Software Engineering Dr. Kazumi Slott Contents Activity Diagram...

More information

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL.

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL. Hello everyone! Welcome to our PHP + MySQL (Easy to learn) E.T.L. free online course Hope you have installed your XAMPP? And you have created your forms inside the studio file in the htdocs folder using

More information

Retrieving Query Results

Retrieving Query Results Using PHP with MySQL Retrieving Query Results The preceding section of this chapter demonstrates how to execute simple queries on a MySQL database. A simple query, as I m calling it, could be defined as

More information

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. Outline. How cookies work. Cookies in PHP. Sessions. Databases. Cookies. Sometimes it is useful to remember a client when it comes

More information

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity]

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity] What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity] MySQL is a database. A database defines a structure for storing information. In a database, there are tables. Just

More information

Introduction to relational databases and MySQL

Introduction to relational databases and MySQL Chapter 3 Introduction to relational databases and MySQL A products table Columns 2017, Mike Murach & Associates, Inc. C3, Slide 1 2017, Mike Murach & Associates, Inc. C3, Slide 4 Objectives Applied 1.

More information

PHP Development - Introduction

PHP Development - Introduction PHP Development - Introduction Php Hypertext Processor PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many

More information

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3 1 Chapter 3 Introduction to relational databases and MySQL Slide 2 Objectives Applied 1. Use phpmyadmin to review the data and structure of the tables in a database, to import and run SQL scripts that

More information

Executing Simple Queries

Executing Simple Queries Script 8.3 The registration script adds a record to the database by running an INSERT query. 1

More information

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population In this lab, your objective is to learn the basics of creating and managing a DB system. One way to interact with the DBMS (MySQL)

More information

Programmer s Guide for PHP

Programmer s Guide for PHP DB Visual ARCHITECT 4.0 Programmer's Guide for PHP The software and documentation are furnished under the DB Visual ARCHITECT license agreement and may be used only in accordance with the terms of the

More information

c360 Web Connect Configuration Guide Microsoft Dynamics CRM 2011 compatible c360 Solutions, Inc. c360 Solutions

c360 Web Connect Configuration Guide Microsoft Dynamics CRM 2011 compatible c360 Solutions, Inc.   c360 Solutions c360 Web Connect Configuration Guide Microsoft Dynamics CRM 2011 compatible c360 Solutions, Inc. www.c360.com c360 Solutions Contents Overview... 3 Web Connect Configuration... 4 Implementing Web Connect...

More information

Chapter 6 Part2: Manipulating MySQL Databases with PHP

Chapter 6 Part2: Manipulating MySQL Databases with PHP IT215 Web Programming 1 Chapter 6 Part2: Manipulating MySQL Databases with PHP Jakkrit TeCho, Ph.D. Business Information Technology (BIT), Maejo University Phrae Campus Objectives In this chapter, you

More information

Create Basic Databases and Integrate with a Website Lesson 3

Create Basic Databases and Integrate with a Website Lesson 3 Create Basic Databases and Integrate with a Website Lesson 3 Combining PHP and MySQL This lesson presumes you have covered the basics of PHP as well as working with MySQL. Now you re ready to make the

More information

Using htmlarea & a Database to Maintain Content on a Website

Using htmlarea & a Database to Maintain Content on a Website Using htmlarea & a Database to Maintain Content on a Website by Peter Lavin December 30, 2003 Overview If you wish to develop a website that others can contribute to one option is to have text files sent

More information

Understanding Basic SQL Injection

Understanding Basic SQL Injection Understanding Basic SQL Injection SQL injection (also known as SQLI) is a code injection technique that occurs if the user-defined input data is not correctly filtered or sanitized of the string literal

More information

User authentication, passwords

User authentication, passwords User authentication, passwords User Authentication Nowadays most internet applications are available only for registered (paying) users How do we restrict access to our website only to privileged users?

More information

More loops. Control structures / flow control. while loops. Loops / Iteration / doing things over and over and over and over...

More loops. Control structures / flow control. while loops. Loops / Iteration / doing things over and over and over and over... Control structures / flow control More loops while loops if... else Switch for loops while... do.. do... while... Much of this material is explained in PHP programming 2nd Ed. Chap 2 Control structures

More information

EXPERIMENT- 9. Login.html

EXPERIMENT- 9. Login.html EXPERIMENT- 9 To write a program that takes a name as input and on submit it shows a hello page with name taken from the request. And it shows starting time at the right top corner of the page and provides

More information

SMS GATEWAY API INTEGRATION GUIDE

SMS GATEWAY API INTEGRATION GUIDE SMS GATEWAY API INTEGRATION GUIDE For PHP Developers Are you a developer or bulk SMS reseller? You can interface your application, website or system with our 247 reliable messaging gateway by using our

More information

Daniel Pittman October 17, 2011

Daniel Pittman October 17, 2011 Daniel Pittman October 17, 2011 SELECT target-list FROM relation-list WHERE qualification target-list A list of attributes of relations in relation-list relation-list A list of relation names qualification

More information

Copyright 2011 Sakun Sharma

Copyright 2011 Sakun Sharma Maintaining Sessions in JSP We need sessions for security purpose and multiuser support. Here we are going to use sessions for security in the following manner: 1. Restrict user to open admin panel. 2.

More information

Create Basic Databases and Integrate with a Website Lesson 5

Create Basic Databases and Integrate with a Website Lesson 5 Create Basic Databases and Integrate with a Website Lesson 5 Forum Project In this lesson we will be creating a simple discussion forum which will be running from your domain. If you wish you can develop

More information

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly Web Programming Lecture 10 PHP 1 Purpose of Server-Side Scripting database access Web page can serve as front-end to a database Ømake requests from browser, Øpassed on to Web server, Øcalls a program to

More information

PHP Introduction. Some info on MySQL which we will cover in the next workshop...

PHP Introduction. Some info on MySQL which we will cover in the next workshop... PHP and MYSQL PHP Introduction PHP is a recursive acronym for PHP: Hypertext Preprocessor -- It is a widely-used open source general-purpose serverside scripting language that is especially suited for

More information

Mastering phpmyadmiri 3.4 for

Mastering phpmyadmiri 3.4 for Mastering phpmyadmiri 3.4 for Effective MySQL Management A complete guide to getting started with phpmyadmin 3.4 and mastering its features Marc Delisle [ t]open so 1 I community experience c PUBLISHING

More information

Technical Guide Login Page Customization

Technical Guide Login Page Customization Released: 2017-11-15 Doc Rev No: R2 Copyright Notification Edgecore Networks Corporation Copyright 2019 Edgecore Networks Corporation. The information contained herein is subject to change without notice.

More information

A SQL Injection : Internal Investigation of Injection, Detection and Prevention of SQL Injection Attacks

A SQL Injection : Internal Investigation of Injection, Detection and Prevention of SQL Injection Attacks A SQL Injection : Internal Investigation of Injection, Detection and Prevention of SQL Injection Attacks Abhay K. Kolhe Faculty, Dept. Of Computer Engineering MPSTME, NMIMS Mumbai, India Pratik Adhikari

More information

A340 Laboratory Session #17

A340 Laboratory Session #17 A340 Laboratory Session #17 LAB GOALS Interacting with MySQL PHP Classes and Objects (Constructors, Destructors, Instantiation, public, private, protected,..) Step 1: Start with creating a simple database

More information

Advanced Web Programming Practice Exam II

Advanced Web Programming Practice Exam II Advanced Web Programming Practice Exam II Name: 12 December 2017 This is a closed book exam. You may use one sheet of notes (8.5X11in, front only) but cannot use any other references or electronic device.

More information

Lab 4: Basic PHP Tutorial, Part 2

Lab 4: Basic PHP Tutorial, Part 2 Lab 4: Basic PHP Tutorial, Part 2 This lab activity provides a continued overview of the basic building blocks of the PHP server-side scripting language. Once again, your task is to thoroughly study the

More information

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted)

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted) A QUICK GUIDE TO PROGRAMMING FOR THE WEB TO GET ACCESS TO THE SERVER: ssh Secure- Shell. A command- line program that allows you to log in to a server and access your files there as you would on your own

More information

ABSOLUTE FORM PROCESSOR ADMINISTRATION OPTIONS

ABSOLUTE FORM PROCESSOR ADMINISTRATION OPTIONS ABSOLUTE FORM PROCESSOR ADMINISTRATION OPTIONS The Absolute Form Processor is very easy to use. In order to operate the system, you just need the menu at the top of the screen. There, you ll find all the

More information

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL Real 1 Options We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional

More information

Introduction to PHP. Fulvio Corno, Laura Farinetti, Dario Bonino, Marco Aime 06/11/08

Introduction to PHP. Fulvio Corno, Laura Farinetti, Dario Bonino, Marco Aime 06/11/08 Introduction to PHP Fulvio Corno, Laura Farinetti, Dario Bonino, Marco Aime Goals Understand server-side architectures based on PHP Learn the syntax and the main constructs of the PHP language Design simple

More information

School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University

School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS351 Database Programming Laboratory Laboratory #9: PHP & Form Processing III Objective:

More information

HTML Tables and Forms. Outline. Review. Review. Example Demo/ Walkthrough. CS 418/518 Web Programming Spring Tables to Display Data"

HTML Tables and Forms. Outline. Review. Review. Example Demo/ Walkthrough. CS 418/518 Web Programming Spring Tables to Display Data CS 418/518 Web Programming Spring 2014 HTML Tables and Forms Dr. Michele Weigle http://www.cs.odu.edu/~mweigle/cs418-s14/ Outline! Assigned Reading! Chapter 4 "Using Tables to Display Data"! Chapter 5

More information

Member registration and searching(2)

Member registration and searching(2) Member registration and searching(2) Initial screen for member registration ( ex11-9.php ) 간단한회원등록및검색서비스 간단한회원등록및검색서비스

More information

Lab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia

Lab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia Lab # 2 Hands-On DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia Part A: Demo by Instructor in Lab a. Data type of MySQL b. CREATE table c. ALTER table (ADD, CHANGE,

More information

n A m I B I A U n I V ER SI TY OF SCIEnCE AnD TECHnOLOGY

n A m I B I A U n I V ER SI TY OF SCIEnCE AnD TECHnOLOGY n A m I B I A U n I V ER SI TY OF SCIEnCE AnD TECHnOLOGY FACULTY OF COMPUTING AND INFORMATICS DEPARTMENT OF INFORMATICS QUALIFICATION: Bachelor of lnformatics and BIT : Business Computing QUALIFICATION

More information

Secure Web-Based Systems Fall Test 1

Secure Web-Based Systems Fall Test 1 Secure Web-Based Systems Fall 2016 CS 4339 Professor L. Longpré Name: Directions: Test 1 This test is closed book and closed notes. However, you may consult the special cheat sheet provided to you with

More information

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

Data Modelling and Databases. Exercise Session 7: Integrity Constraints Data Modelling and Databases Exercise Session 7: Integrity Constraints 1 Database Design Textual Description Complete Design ER Diagram Relational Schema Conceptual Modeling Logical Modeling Physical Modeling

More information

// 範例 4-1: 連結資料庫 (connectdb.php) <?php mysql_connect("localhost", "student", "Asia2013"); mysql_select_db("student");?>

// 範例 4-1: 連結資料庫 (connectdb.php) <?php mysql_connect(localhost, student, Asia2013); mysql_select_db(student);?> // 範例 4-1: 連結資料庫 (connectdb.php) mysql_connect("localhost", "student", "Asia2013"); mysql_select_db("student"); // 範例 4-2: 以 PHP 建立資料表 (gbcreate.php) $aa=" create table gb ( gbprikey integer auto_increment

More information

If you do not specify any custom parameters, we will deliver the message using the default names.

If you do not specify any custom parameters, we will deliver the message using the default names. Inbound SMS to UK landline numbers API HTTP GET/POST variables If you choose to have the messages delivered by HTTP, you may either use our standard parameters, or create a custom format for compatibility

More information

COSC344 Database Theory and Applications PHP & SQL. Lecture 14

COSC344 Database Theory and Applications PHP & SQL. Lecture 14 COSC344 Database Theory and Applications Lecture 14: PHP & SQL COSC344 Lecture 14 1 Last Lecture Java & SQL Overview This Lecture PHP & SQL Revision of the first half of the lectures Source: Lecture notes,

More information

CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks

CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS DATE: 30.9.11 Aim: To create a servlet program to display the students marks Hardware requirements: Intel Core 2 Quad 2GB RAM Software requirements:

More information

PHP 5 if...else...elseif Statements

PHP 5 if...else...elseif Statements PHP 5 if...else...elseif Statements Conditional statements are used to perform different actions based on different conditions. PHP Conditional Statements Very often when you write code, you want to perform

More information

HTML Forms IT WS I - Lecture 11

HTML Forms IT WS I - Lecture 11 HTML Forms IT WS I - Lecture 11 Saurabh Barjatiya International Institute Of Information Technology, Hyderabad 04 October, 2009 Contents Seeing submitted values 1 Seeing submitted values 2 3 Seeing submitted

More information

Web Systems Nov. 2, 2017

Web Systems Nov. 2, 2017 Web Systems Nov. 2, 2017 Topics of Discussion Using MySQL as a Calculator Command Line: Create a Database, a Table, Insert Values into Table, Query Database Using PhP API to Interact with MySQL o Check_connection.php

More information

CSC 405 Computer Security. Web Security

CSC 405 Computer Security. Web Security CSC 405 Computer Security Web Security Alexandros Kapravelos akaprav@ncsu.edu (Derived from slides by Giovanni Vigna and Adam Doupe) 1 The XMLHttpRequest Object Microsoft developers working on Outlook

More information

blink.html 1/1 lectures/6/src/ form.html 1/1 lectures/6/src/

blink.html 1/1 lectures/6/src/ form.html 1/1 lectures/6/src/ blink.html 1/1 3: blink.html 5: David J. Malan Computer Science E-75 7: Harvard Extension School 8: 9: --> 11:

More information

CSC 405 Computer Security. Web Security

CSC 405 Computer Security. Web Security CSC 405 Computer Security Web Security Alexandros Kapravelos akaprav@ncsu.edu (Derived from slides by Giovanni Vigna and Adam Doupe) 1 source: https://xkcd.com/327/ 2 source: https://xkcd.com/327/ 3 source:

More information

PHP: Hypertext Preprocessor. A tutorial Introduction

PHP: Hypertext Preprocessor. A tutorial Introduction PHP: Hypertext Preprocessor A tutorial Introduction Introduction PHP is a server side scripting language Primarily used for generating dynamic web pages and providing rich web services PHP5 is also evolving

More information

Accessing databases in Java using JDBC

Accessing databases in Java using JDBC Accessing databases in Java using JDBC Introduction JDBC is an API for Java that allows working with relational databases. JDBC offers the possibility to use SQL statements for DDL and DML statements.

More information

Relational databases and SQL

Relational databases and SQL Relational databases and SQL Relational Database Management Systems Most serious data storage is in RDBMS Oracle, MySQL, SQL Server, PostgreSQL Why so popular? Based on strong theory, well-understood performance

More information

Locate your Advanced Tools and Applications

Locate your Advanced Tools and Applications MySQL Manager is a web based MySQL client that allows you to create and manipulate a maximum of two MySQL databases. MySQL Manager is designed for advanced users.. 1 Contents Locate your Advanced Tools

More information

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2 Department of Computer Science University of Cyprus EPL342 Databases Lab 2 ER Modeling (Entities) in DDS Lite & Conceptual Modeling in SQL Server 2008 Panayiotis Andreou http://www.cs.ucy.ac.cy/courses/epl342

More information

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310 Warm up mini-lab Lab 1 - Functions Type in the following function definition and calls to the function. Test it and understand it. function myprint($str= No String Supplied ) // the argument is optional

More information

This program is a self-contained web server and interface for MediaPortal TV Engine edition.

This program is a self-contained web server and interface for MediaPortal TV Engine edition. MediaPortal Web Server and Interface. This program is a self-contained web server and interface for MediaPortal TV Engine edition. It is designed for users who either don t have a web server on their computer,

More information

Chapter 3 Introduction to relational databases and MySQL

Chapter 3 Introduction to relational databases and MySQL Chapter 3 Introduction to relational databases and MySQL Murach's PHP and MySQL, C3 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Applied 1. Use phpmyadmin to review the data and structure of

More information

SQL. Often times, in order for us to build the most functional website we can, we depend on a database to store information.

SQL. Often times, in order for us to build the most functional website we can, we depend on a database to store information. Often times, in order for us to build the most functional website we can, we depend on a database to store information. If you ve ever used Microsoft Excel or Google Spreadsheets (among others), odds are

More information

More MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION

More MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION SESSION ELEVEN 11.1 Walkthrough examples More MySQL This session is designed to introduce you to some more advanced features of MySQL, including loading your own database. There are a few files you need

More information

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations Show Only certain columns and rows from the join of Table A with Table B The implementation of table operations

More information

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) SQL language Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 SQL - Structured Query Language SQL is a computer language for communicating with DBSM Nonprocedural (declarative) language What

More information

SynApp2 Walk through No. 1

SynApp2 Walk through No. 1 SynApp2.org SynApp2 Walk through No. 1 Generating and using a web application 2009 Richard Howell. All rights reserved. 2009-08-26 SynApp2 Walk through No. 1 Generating and using a web application The

More information

SCRIPTING, DATABASES, SYSTEM ARCHITECTURE

SCRIPTING, DATABASES, SYSTEM ARCHITECTURE introduction to SCRIPTING, DATABASES, SYSTEM ARCHITECTURE PHP II: while loops, for loops, functions Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D. ((( Software and Systems ))) IT University

More information

Building an E-mini Trading System Using PHP and Advanced MySQL Queries ( ) - Contributed by Codex-M

Building an E-mini Trading System Using PHP and Advanced MySQL Queries ( ) - Contributed by Codex-M Building an E-mini Trading System Using PHP and Advanced MySQL Queries (2009-11-10) - Contributed by Codex-M This article shows illustrative examples of how PHP and some advanced MySQL queries can be used

More information

CICS 515 b Internet Programming Week 2. Mike Feeley

CICS 515 b Internet Programming Week 2. Mike Feeley CICS 515 b Internet Programming Week 2 Mike Feeley 1 Software infrastructure stuff MySQL and PHP store files in public_html run on remote.mss.icics.ubc.ca access as http://ws.mss.icics.ubc.ca/~username/...

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University Computer Sciences Department 1 And use http://www.w3schools.com/ PHP Part 3 Objectives Creating a new MySQL Database using Create & Check connection with Database

More information

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier Use of PHP for DB Connection 1 2 Middle and Information Tier PHP: built in library functions for interfacing with the mysql database management system $id = mysqli_connect(string hostname, string username,

More information

Using MySQL on the Winthrop Linux Systems

Using MySQL on the Winthrop Linux Systems Using MySQL on the Winthrop Linux Systems by Dr. Kent Foster adapted for CSCI 297 Scripting Languages by Dr. Dannelly updated March 2017 I. Creating your MySQL password: Your mysql account username has

More information

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL Chapter4: HTML Table and Script page, HTML5 new forms Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL Objective To know HTML5 creating a new style form. To understand HTML table benefits

More information

IS 2150 / TEL 2810 Introduction to Security

IS 2150 / TEL 2810 Introduction to Security IS 2150 / TEL 2810 Introduction to Security James Joshi Professor, SIS Lecture 15 April 20, 2016 SQL Injection Cross-Site Scripting 1 Goals Overview SQL Injection Attacks Cross-Site Scripting Attacks Some

More information

DIGITAL STORYTELLING. Ntombesisa Mateyisi. A Project submitted in partial fulfillment of the requirements for the degree of.

DIGITAL STORYTELLING. Ntombesisa Mateyisi. A Project submitted in partial fulfillment of the requirements for the degree of. DIGITAL STORYTELLING by Ntombesisa Mateyisi A Project submitted in partial fulfillment of the requirements for the degree of BSc (Honours) University of the Western Cape 2016 Date: January 16, 2017 University

More information

Spring 2014 Interim. HTML forms

Spring 2014 Interim. HTML forms HTML forms Forms are used very often when the user needs to provide information to the web server: Entering keywords in a search box Placing an order Subscribing to a mailing list Posting a comment Filling

More information

Database Systems. phpmyadmin Tutorial

Database Systems. phpmyadmin Tutorial phpmyadmin Tutorial Please begin by logging into your Student Webspace. You will access the Student Webspace by logging into the Campus Common site. Go to the bottom of the page and click on the Go button

More information

The connection has timed out

The connection has timed out 1 of 7 2/17/2018, 7:46 AM Mukesh Chapagain Blog PHP Magento jquery SQL Wordpress Joomla Programming & Tutorial HOME ABOUT CONTACT ADVERTISE ARCHIVES CATEGORIES MAGENTO Home» PHP PHP: CRUD (Add, Edit, Delete,

More information

How to use SQL to create a database

How to use SQL to create a database Chapter 17 How to use SQL to create a database How to create a database CREATE DATABASE my_guitar_shop2; How to create a database only if it does not exist CREATE DATABASE IF NOT EXISTS my_guitar_shop2;

More information

CSE 127: Computer Security SQL Injection. Vector Li

CSE 127: Computer Security SQL Injection. Vector Li CSE 127: Computer Security SQL Injection Vector Li November 14, 2017 A Magic Trick The functional specification only allowed seeing one user s posts at a time Current user s posts on view.php without

More information

ゼミ Wiki の再構築について 資料編 加納さおり

ゼミ Wiki の再構築について 資料編 加納さおり Wiki [ Fukuda Semi Wiki] [ 2 wiki] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 Menu1] [ 15 Menu2] [ 16 Menu3] [ 17 wiki Menu] [ 18 TOP ] [ 19 ] [ 20 ] [ 20] [ 21 ] [ 22 (

More information

Jackson State University Department of Computer Science CSC / Advanced Information Security Spring 2013 Lab Project # 3

Jackson State University Department of Computer Science CSC / Advanced Information Security Spring 2013 Lab Project # 3 Jackson State University Department of Computer Science CSC 439-01/539-02 Advanced Information Security Spring 2013 Lab Project # 3 Use of CAPTCHA (Image Identification Strategy) to Prevent XSRF Attacks

More information

Server Side Scripting Report

Server Side Scripting Report Server Side Scripting Report David Nelson 205CDE Developing the Modern Web Assignment 2 Student ID: 3622926 Computing BSc 29 th March, 2013 http://creative.coventry.ac.uk/~nelsond/ - Page 1 - Contents

More information

CMSC 330: Organization of Programming Languages. Markup & Query Languages

CMSC 330: Organization of Programming Languages. Markup & Query Languages CMSC 330: Organization of Programming Languages Markup & Query Languages Other Language Types Markup languages Set of annotations to text Query languages Make queries to databases & information systems

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Markup & Query Languages Other Language Types Markup languages Set of annotations to text Query languages Make queries to databases & information systems

More information

CITS1231 Web Technologies. PHP s, Cookies and Session Control

CITS1231 Web Technologies. PHP  s, Cookies and Session Control CITS1231 Web Technologies PHP Emails, Cookies and Session Control Sending email with PHP We have looked at storing user information using files. Email messages can also be thought of as data streams, providing

More information

"Charting the Course... Intermediate PHP & MySQL Course Summary

Charting the Course... Intermediate PHP & MySQL Course Summary Course Summary Description In this PHP training course, students will learn to create database-driven websites using PHP and MySQL or the database of their choice. The class also covers SQL basics. Objectives

More information

Using PHP with MYSQL

Using PHP with MYSQL Using PHP with MYSQL PHP & MYSQL So far you've learned the theory behind relational databases and worked directly with MySQL through the mysql command-line tool. Now it's time to get your PHP scripts talking

More information

Web accessible Databases PHP

Web accessible Databases PHP Web accessible Databases PHP October 16, 2017 www.php.net Pacific University 1 HTML Primer https://www.w3schools.com/html/default.asp HOME Introduction Basic Tables Lists https://developer.mozilla.org/en-

More information