diff --git a/array.php b/array.php new file mode 100644 index 0000000..b1e74b4 --- /dev/null +++ b/array.php @@ -0,0 +1,30 @@ + +

Php Array

+'Mikko',"sn"=>'Virtanen'), + array("en"=>'Liisa',"sn"=>'Virta'), + array("en"=>'Jussi',"sn"=>'Jokinen'), + array("en"=>'Aino',"sn"=>'Järvinen') + ); +echo "

Print_r

"; +print_r($asiakkaat); +?> +

Tulostus foreach-loopilla

+'; +} +?> +

Tulostus taulukkona

+ + + '; + } + ?> +
EtunimiSukunimi
'.$rivi['en'].''.$rivi['sn'].'
+ + \ No newline at end of file diff --git a/asiakas.php b/asiakas.php new file mode 100644 index 0000000..07cacf9 --- /dev/null +++ b/asiakas.php @@ -0,0 +1,17 @@ + +

Asiakkaat

+query($sql); + echo ""; + echo ""; + foreach ($asiakkaat as $rivi) { + echo ''; + } + echo "
EtunimiSukunimi
'.$rivi['etunimi'].''.$rivi['sukunimi'].'
"; + +?> + + \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..d95347f --- /dev/null +++ b/footer.php @@ -0,0 +1,5 @@ + +
+Pekka Alaluukas 2016 + + \ No newline at end of file diff --git a/get.php b/get.php new file mode 100644 index 0000000..36edc64 --- /dev/null +++ b/get.php @@ -0,0 +1,22 @@ + +

Testataan get-metodia

+ +
+ + +
+ + +
+ +
+ + + + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..e8ee3d5 --- /dev/null +++ b/index.php @@ -0,0 +1,15 @@ + + +

Esimerkki2

+

+ Tällä sivustolla on harjoiteltu php-ohjelmointia ja + css-tiedoston käyttöä. +

+

+ Tiedostoa yhteys.php ei pitäisi viedä githubiin, jos kyseessä olisi oikea sovellus. + Nythän käytämme public-tyyppistä git-repositoryä, joka on siis kaikkien luettavissa. + Ja koska, tuossa yhteys-tiedostossa on tietokannan salasana, se kannattaisi siis + poistaa Git-hubista. Ja sitten kannattaisi tehdä .gitignore tiedosto ja merkitä sinne tuo "yhteys.php". +

+ + \ No newline at end of file diff --git a/menu.php b/menu.php new file mode 100644 index 0000000..45ea712 --- /dev/null +++ b/menu.php @@ -0,0 +1,19 @@ + + + +Esimerkki2 + + + + +
\ No newline at end of file diff --git a/post.php b/post.php new file mode 100644 index 0000000..a402663 --- /dev/null +++ b/post.php @@ -0,0 +1,21 @@ + +

Testataan post-metodia

+
+ + +
+ + +
+ +
+ + + + \ No newline at end of file diff --git a/sql.php b/sql.php new file mode 100644 index 0000000..95f0b0d --- /dev/null +++ b/sql.php @@ -0,0 +1,22 @@ + +
+CREATE DATABASE esim2 DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci;
+
+USE esim2;
+
+CREATE TABLE asiakkaat (
+id_asiakas INT primary key auto_increment,
+etunimi VARCHAR(50),
+sukunimi VARCHAR(50)
+);
+
+
+INSERT INTO asiakkaat (etunimi,sukunimi) VALUES('Matti','Virtanen');
+INSERT INTO asiakkaat (etunimi,sukunimi) VALUES('Jussi','Virta');
+INSERT INTO asiakkaat (etunimi,sukunimi) VALUES('Liisa','Joki');
+INSERT INTO asiakkaat (etunimi,sukunimi) VALUES('Aino','Järvinen');
+
+GRANT ALL ON esim2.* TO 'phpuser'@'localhost' IDENTIFIED BY 'phppass';
+
+
+ \ No newline at end of file diff --git a/tyyli.css b/tyyli.css new file mode 100644 index 0000000..dca178b --- /dev/null +++ b/tyyli.css @@ -0,0 +1,19 @@ +label { + color: blue; +} + +#menu { + float: left; + width: 150px; + background-color: gray; +} +#menu ul { + list-style: none; +} +#menu ul a:hover { + background-color: white; +} + +#sisalto { + margin-left: 170px; +} diff --git a/yhteys.php b/yhteys.php new file mode 100644 index 0000000..a805167 --- /dev/null +++ b/yhteys.php @@ -0,0 +1,13 @@ + \ No newline at end of file