PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.

Slides:



Advertisements
Similar presentations
LIS651 lecture 3 taming PHP Thomas Krichel
Advertisements

Widhy Hayuhardhika NP, S.Kom. Overview of database structure Connecting to MySQL database Selecting the database to use Using the require_once statement.
Murach's MySQL, C1 © 2012, Mike Murach & Associates, Inc. Slide 1.
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.
Murach's PHP and MySQL, C4© 2010, Mike Murach & Associates, Inc.Slide 1.
Web Database Programming Connecting Database to Web.
PHP and MySQL PHP for the Web, page PHP and MySQL MySQL Resource PHP – MySQL Resource
Multiple Tiers in Action
A complete web app using flex. You can use the flex builder to generate the php (server side) code for a flex-php application. As before, Php connects.
Lecture 4: Introduction to PHP 3 PHP & MySQL
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Encrypted Passwords. your_password + username $u = crypt ( your_password ) PHP insert username + $u SQL MySQL database username | encrypted password username.
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
PHP : Working with Resultsets. Last class  Open a connection to the MySQL server.  Specify the database  Issue queries (no updates at this stage) 
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.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Class 3 MySQL Robert Mudge Reference:
Website Security ISYS 475. Authentication Authentication is the process that determines the identity of a user.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
INTERNET APPLICATION DEVELOPMENT For More visit:
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
Introduction to MySQL Lab no. 10 Advance Database Management System.
MySQL and PHP 3 March 2006 Adina Crainiceanu IT420: Database Management and Organization.
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Lec_6 Manipulating MySQL Databases with PHP PHP Programming with MySQL.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Lecture 10 – MYSQL and PHP (Part 2)
PHP with MySQL 1.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy.
Retrieving data from MySQL using PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
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.
Accessing mySQL relational database. MySQL database.  Today, we will attempt and open a connection to the MySQL server.  We need to specify the database.
PHP Programming. Topics Database Handling (MySQL, MSSQL, ODBC)
Database MySQL Universitas Muhammadiyah Surakarta Yogiek Indra Kurniawan.
>> PHP: File Uploads. Pre-requisite Go Online – Download file modify-item.php – copy it to your root folder (D:\xampp\htdocs\Buy4mMe) Web-Based Systems.
Server-Side Solutions Steve Perry
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
MySQL MySQL and PHP – interacting with a database.
How Web Database Architectures Work CPS181s April 8, 2003.
Chapter 9 Using PHP with MySQL Part 2. view_users.php Script 9.4 on page 283 iew_users.php
Display Page (HTML/CSS)
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
How To Start a SQL server Connecting to SQL Server.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Unix System Administration
Web Design and Development
Chapter 9 Using PHP with MySQL.
Introduction to Web programming
Oracle Accounts on Campus
Installation First Server
ISC440: Web Programming 2 Server-side Scripting PHP 3
Chapter 13 Security Methods Part 3.
Using PHP with MySQL Part 2
PHP: Database Basic Selection FdSc Module 109
Create New User in Database. First Connect the System.
MySQL Web Application Connecting to a MySQL database
Introduction to Web programming
Presentation transcript:

PHP SQL

Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect = mysql_connect("localhost","root","") or die("Cannot Connect"); localhost server name root username password die display error message when cannot connect

PHP SQL mysql_select_db("database_name") Selecting a database within a connected database server. Eg mysql_select_db(phpdb") or die("Database not found"); phpdb database name die display error message when data base not exisit

PHP SQL mysql_query('TYPE_HERE_YOUR_MYSQL_QUERY') This function is used to run specific queries on our database Eg $query= mysql_query("select * From login_table WHERE username='$username'"); Login_table table name

PHP SQL $numrows = mysql_num_rows($query); Count no of row that satisfies the query

PHP SQL Login page User name Password

PHP SQL 'login.php page <?php $username = $_POST['username']; $password = $_POST['password']; if($username && $password)//check username and password null { $connect = mysql_connect("localhost","root","") or die("Cannot Connect"); mysql_select_db(phpdb") or die("Database not found"); $query= mysql_query("select * From login_table WHERE username='$username'"); $numrows = mysql_num_rows($query); echo $numrows; } else die("Please enter username and Password!"); ?>

PHP SQL <?php $username = $_POST['username']; $password = $_POST['password']; if($username && $password) { $connect = mysql_connect("localhost","root","") or die("Couldn't connect!"); mysql_select_db("phpdb") or die("Couldn't find db"); $query= mysql_query("SELECT * From login_table WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) { while($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; } if($username==$dbusername&&$password==$dbpassword) { //code for in echo "You're in!"; } else echo "Incorrect password!"; } else die("That user does't exist!"); } else die("Please enter username and Password!"); ?>

MySQL