This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bmi ($height,$mass) | |
{ | |
$height = $height / 100; | |
$mass = $mass / ($height * $height); | |
return $mass; | |
} | |
function h($str) { | |
return htmlspecialchars($str, ENT_QUOTES, "UTF-8"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
public class DataAccess { | |
public static void main(String[] args) { | |
DataAccess dataAccess =new DataAccess(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'MDB2.php'; | |
//$db = MDB2::connect('mysql://s11011:password@localhost/db11'); | |
$db = MDB2::connect('oci8://s11011:[email protected]:1521/?service=db11'); | |
if (MDB2::isError($db)) { die("connection error: " . $db->getMessage()); } | |
$q = $db->query("CREATE TABLE dishes ( | |
dish_id INT, | |
dish_name VARCHAR(255), | |
price DECIMAL(4,2), | |
is_spicy INT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<?php | |
// Load PEAR MDB2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//print a text box | |
function input_text($element_name, $values) { | |
print '<input type="text" name="' . $element_name .'" value="'; | |
print h($values[$element_name]) . '">'; | |
} | |
//print a submit button | |
function input_submit($element_name, $label) { | |
print '<input type="submit" name="' . $element_name .'" value="'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create Table for 実習 */ | |
DROP TABLE IF EXISTS ord_details; | |
DROP TABLE IF EXISTS orders; | |
DROP TABLE IF EXISTS customers; | |
DROP TABLE IF EXISTS employees; | |
DROP TABLE IF EXISTS departments; | |
DROP TABLE IF EXISTS salgrades; | |
DROP TABLE IF EXISTS products; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load PEAR MDB2 | |
require 'MDB2.php'; | |
// Load the form helper functions | |
require 'formhelpers.php'; | |
// Connect to the database | |
require 'connect_mysql.php'; | |
$db = connect_mysql(); | |
// Set up automatic error handling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function connect_mysql(){ | |
$db = MDB2::connect('mysql://test:pass@localhost/testphp'); | |
if (MDB2::isError($db)) { die("connection error: " . $db->getMessage()); } | |
return $db; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load PEAR MDB2 | |
require 'MDB2.php'; | |
// Load the form helper functions. | |
require 'formhelpers.php'; | |
require 'connect_mysql.php'; | |
// Connect to the database |
OlderNewer