200 likes | 314 Views
SQL i internet. PHP i MySQL. Programy. MySQL: server WWW server Interpreter PHP Przeglądarka stron www. Programy MySQL. MySQL 5.0 Windows (x86) 5.0.22 36.7M http://www.mysql.com/ MySQL Administrator Windows (x86)1.1.95.0M http://www.mysql.com/
E N D
SQL i internet PHP i MySQL
Programy • MySQL: server • WWW server • Interpreter PHP • Przeglądarka stron www
ProgramyMySQL • MySQL 5.0Windows (x86) 5.0.22 36.7Mhttp://www.mysql.com/ • MySQL Administrator Windows (x86)1.1.95.0M http://www.mysql.com/ • MySQL Querry Browser (x86)1.1.205.1M http://www.mysql.com/
Serwer www • Apache apache_1.3.35-win32-x86-src.msi www.apache.org • Microsoft Internet Information Server (IIS), Win 2000, Win XP www.microsoft.com • Microsoft Personal Web Server (PWS) Win98 • Xitami.
PHP 5.1.4http://www.php.net/ • PHP 5.1.4 ( współpracuje z MYSQL 5.0.18.nt) • Non-windows: Complete Source Code • PHP 5.1.4 (tar.bz2) [6,207Kb] - 04 May 2006PHP 5.1.4 (tar.gz) [7,920Kb] - 04 May 2006Windows Binaries • PHP 5.1.4 zip package [8,919Kb] - 04 May 2006md5: bf208201a671fd20a13490dc6f38b344 • Collection of PECL modules for PHP 5.1.4 [2,227Kb] - 04 May 2006md5: ff5ac6c4db975bc3ff2f3a89b7881c3f • PHP 5.1.4 installer [2,639Kb] - 04 May 2006(CGI only, packaged as Windows installer to install and configure PHP, and automatically configure IIS, PWS and Xitami, with manual configuration for other servers. No external extensions included, get them from the zip and PECL downloads above, and install manually)md5: 86d83c9f42e281c60a40cf7c6d66db8d
Konfiguracja PHP i MySQLi (bo to wersja PHP v 5 i MySQL v5 doc_root = c:\inetpub\wwwroot // for IIS/PWS
Konfiguracja MySQLi (bo to wersja PHP v 5 i MySQL v5 Runtime Configuration The behaviour of these functions is affected by settings in php.ini. Table 158. MySQLi Configuration Options
PHP – Hello.php <html> <head> <title>Test PHP</title> </head> <body> <?php echo "<p>Witaj na zajęciach POPOQ !</p>"; ?> </body> </html>
PHP -> HTML <html> <head> <title>Test PHP</title> </head> <body> <?php echo "<p>Witaj na zajęciach POPOQ !</p>"; ?> </body> </html> <html> <head> <title>Test PHP</title> </head> <body> <p>Witaj na zajęciach POPOQ !</p> </body> </html>
SQL i internet :MySQL.PHP <?php ////$link = mysql_connect(„serwer", "uzytkownik", "haslo”,” baza”) printf ("Nowy przyklad"); $link = mysqli_connect("hefajstos", "popoq", "popoq", "popoq"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); }
SQL i internet cd.1 • /* return name of current default database */ • if ($result = mysqli_query($link, "SELECT DATABASE()")) • { • $row = mysqli_fetch_row($result); • printf("Default database is %s.\n", $row[0]); • mysqli_free_result($result); • }
SQL i internet cd2 • /* change db to „popoq” db */ • mysqli_select_db($link, "popoq"); • /* return name of current default database */ • if ($result = mysqli_query($link, "SELECT DATABASE()")) • { • $row = mysqli_fetch_row($result); • printf("Default database is %s.\n", $row[0]); • mysqli_free_result($result); • }
SQL i internet cd 3 • /* Wysyłanie zapytania SQL */ • $query = "SELECT * FROM przedmioty"; • $result = mysqli_query ($link, $query) • or die ("Zapytanie zakończone niepowodzeniem");
PHP cd4 • /* Wyświetlenie wyników w HTML */ • print "<HTML>\n"; • print "<BODY>\n"; • print "<table>\n"; • while ($line = mysqli_fetch_array($result, MYSQLI_ASSOC)) • { • print "\t<tr>\n"; • foreach ($line as $col_value) • { • print "\t\t<td>$col_value</td>\n"; • } • print "\t</tr>\n"; • } • print "</table>\n";
PHP cd5: finał • print "</BODY>\n"; • print "</HTML>\n"; • mysqli_close($link); • ?>