MySQL GUI Tools MySQL & PHP - University Of Michigan

Transcription

MySQL GUI ToolsMySQL & PHPJeff Kopmanis, Mathematicskopmanis@umich.edu

Command Line Utility

Command Line Utility

Command Line UtilityCrowded

Command Line UtilityCrowdedNot suited well for wide results

Command Line UtilityCrowdedNot suited well for wide resultsCan’t see results & structureat the same time

GUI Tools Multi-platform

GUI Tools Multi-platform Microsoft Windows

GUI Tools Multi-platform Microsoft Windows Linux (RedHat, SuSE, Debian, Others)

GUI Tools Multi-platform Microsoft Windows Linux (RedHat, SuSE, Debian, Others) MacOSX

GUI Tools Multi-platform Microsoft Windows Linux (RedHat, SuSE, Debian, Others) MacOSX A “Workbench” for SQL tasks

GUI Tools Multi-platform Microsoft Windows Linux (RedHat, SuSE, Debian, Others) MacOSX A “Workbench” for SQL tasks STANDARD!

GUI Tools Multi-platform Microsoft Windows Linux (RedHat, SuSE, Debian, Others) MacOSX A “Workbench” for SQL tasks STANDARD! Open Source - FREE!

MySQL Administrator

MySQL Administrator GUI Administrative Tool

MySQL Administrator GUI Administrative Tool Open Source - Freely available

MySQL Administrator GUI Administrative Tool Open Source - Freely available Maintained by MySQL AB

MySQL Administrator GUI Administrative Tool Open Source - Freely available Maintained by MySQL AB Available on major OS’s

MySQL Administrator GUI Administrative Tool Open Source - Freely available Maintained by MySQL AB Available on major OS’s Windows

MySQL Administrator GUI Administrative Tool Open Source - Freely available Maintained by MySQL AB Available on major OS’s Windows Linux

MySQL Administrator GUI Administrative Tool Open Source - Freely available Maintained by MySQL AB Available on major OS’s Windows Linux MacOSX

MySQL AdministratorDemo

MySQL Query Browser

MySQL Query Browser

MySQL Query Browser

MySQL Query Browser

MySQL Query Browser

CocoaMySQLDemo

Dynamic Web PagesMySQL & PHP

“Why would I want touse a Dynamic page!?”

“Why would I want touse a Dynamic page!?” When content has to be updated frequently

“Why would I want touse a Dynamic page!?” When content has to be updated frequently When content is interdependent

“Why would I want touse a Dynamic page!?” When content has to be updated frequently When content is interdependent When you want a page to be configurable

“Why would I want touse a Dynamic page!?” When content has to be updated frequently When content is interdependent When you want a page to be configurable When other software has to get at the data

“Why would I want touse a Dynamic page!?” When content has to be updated frequently When content is interdependent When you want a page to be configurable When other software has to get at the data What’s your idea for a dynamic page?

Anatomy of a DynamicWeb Page1. Submit a URL to your ser

Anatomy of a DynamicWeb Page2. Browser sends request to web erWebServer

Anatomy of a DynamicWeb Page3. Web server runs a uage

Anatomy of a DynamicWeb Page4. Script makes SQL Queries for dataSELECT * FROM ase

Anatomy of a DynamicWeb Page5. Database returns data to script for processingSafariBrowserWebServerScriptLanguage123, Jeff456, Mary789, DaveSQLDatabase

Anatomy of a DynamicWeb Page6. Script prepares HTML andsends it to the Web ServerSafariBrowserWebServerScriptLanguage. td 123 /td td Jeff /td /tr tr td 456.SQLDatabase

Anatomy of a DynamicWeb Page7. Web server finishes processing andsends stream to your browserSafariBrowser. td 123 /td td Jeff /td /tr tr td 456.WebServerScriptLanguageSQLDatabase

Anatomy of a DynamicWeb Page8.Your browser renders the HTMLand displays the formatted resultsSafariBrowser

Some PHP Examples

hello.php ?print "Hello, World!";?

hello.phpTSELP ?MISprint "Hello,World!";SM’A? LDRGROORWP

hello vars.php center ? hello “Hello”; world “World”;print hello.”, “. world.” br ”;? /center hr

hello vars.phpDN center OCM ?EASR hello “Hello”;SG’O world “World”;DLRprint R hello.”, “. world.” br ”;POT? SWE /center LP hr MIS

db.php ?######################## Make Database connection db mysql connect("localhost","root","");mysql select db("inventory", db); sql "SELECT ipaddr,hostname FROM machines”; result mysql query( sql);while( datarow mysql fetch array( result) ) {# 2 print statements for prettiness!print “ip ”. datarow[‘ipaddr’];print ” hostname ”. datarow[‘host’].” br \n”;}mysql close( db);?

db.php

db form.php ?######################## Make Database connection db mysql connect("localhost","root","");mysql select db("inventory", db);# shows how concatenation can be used to build strings sql "SELECT ipaddr,hostname FROM machines“; sql . “ WHERE hostname '". GET['fhost']."'"; result mysql query( sql);while( datarow mysql fetch array( result) ) {print "ip ". datarow['ipaddr'];print " hostname ". datarow['hostname']." br \n";}mysql close( db);?

db form.php

all in one.php html head title All-in-One PHP File /title /head form method post action "all in one.php" input type text name "fhost" value ' ? POST[fhost]? ' size 25 maxlength 25 input type submit value ' LOOK IT UP! ' /form hr table width 100% ?######################## Make Database connection db mysql connect("localhost","root","");mysql select db("inventory", db); sql "SELECT hostname,ipaddr FROM machines WHERE hostname '". POST[fhost].”’”; result mysql query( sql);while( datarow mysql fetch array( result) ) {print " tr td width 50% datarow[‘hostname’] /td td width 50% ";print datarow[‘ipaddr’];print " /td /tr \n";}print " tr td colspan 2 hr /td /tr \n";? /table /html

all in one.php

PHP-enabled SitesDemo

Online Resources http://www.mysql.comMySQL Home http://serverlogistics.com/mysql.phpComplete MySQL http://www.php.net/PHP Home page http://versiontracker.comWhere to find CocoaMySQL

BooksPHP and MySQL Web Development(3rd Edition)Luke Welling, Laura ThompsonISBN: 0672326728PHP CookbookDavid Sklar, Adam TrachtenbergISBN: 1565926811

Q &AThanks for coming!

PHP and MySQL Web Development (3rd Edition) Luke Welling, Laura Thompson ISBN: 0672326728 PHP Cookbook David Sklar, Adam Trachtenberg ISB