Compare commits
2 Commits
a1040bd5db
...
3a3c99701f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a3c99701f | ||
|
|
576d664240 |
@@ -27,8 +27,6 @@ if(!$fp){
|
|||||||
$header_array =fgetcsv($fp, 0, ";");
|
$header_array =fgetcsv($fp, 0, ";");
|
||||||
|
|
||||||
|
|
||||||
print_r($header_array);
|
|
||||||
|
|
||||||
// CREATE XML DOM
|
// CREATE XML DOM
|
||||||
$xmlDoc = new DOMDocument("1.0", "utf-8");
|
$xmlDoc = new DOMDocument("1.0", "utf-8");
|
||||||
$xmlDoc->formatOutput=true;
|
$xmlDoc->formatOutput=true;
|
||||||
@@ -55,7 +53,6 @@ while(($row_array = fgetcsv($fp, 0, ";")) !== false){
|
|||||||
|
|
||||||
// get current collumn
|
// get current collumn
|
||||||
$column = $header_array[$i];
|
$column = $header_array[$i];
|
||||||
echo "$row_array[$i]<br>";
|
|
||||||
|
|
||||||
// create a new element with name of column and row data
|
// create a new element with name of column and row data
|
||||||
$xmlSchuelerDaten = $xmlDoc->createElement($column, $row_array[$i]);
|
$xmlSchuelerDaten = $xmlDoc->createElement($column, $row_array[$i]);
|
||||||
@@ -66,5 +63,7 @@ while(($row_array = fgetcsv($fp, 0, ";")) !== false){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save whole XML file
|
// Save whole XML file
|
||||||
$fileXml = "e2fi2.xml";
|
$fileXML = "e2fi2.xml";
|
||||||
$xmlDoc->save(__DIR__ . "/$fileXml");
|
$xmlDoc->save(__DIR__ . "/$fileXML");
|
||||||
|
|
||||||
|
echo "CSV FILE ($fileCSV) CONVERTED TO XML ($fileXML) AND SAVED";
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
SELECT book.bibNr, book.titel, COUNT(book.bibNr) AS ausleihAnzahl
|
||||||
|
FROM buch as book
|
||||||
|
LEFT JOIN Ausleihe as rent ON book.bibNr = rent.bibNr
|
||||||
|
AND YEAR(rent.ausleihdatum) = 2015
|
||||||
|
GROUP BY book.bibNr, book.titel
|
||||||
|
ORDER BY ausleihAnzahl ASC
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
SELECT ProductID, SUM(Quantity) AS orderAnzahl
|
||||||
|
FROM OrderDetails
|
||||||
|
GROUP BY ProductID
|
||||||
|
ORDER BY orderAnzahl ASC;
|
||||||
47
Zweites Jahr/aufgaben/saveLibaryDataInXml/task.md
Normal file
47
Zweites Jahr/aufgaben/saveLibaryDataInXml/task.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# 2.2 XML
|
||||||
|
|
||||||
|
## 2.2.1
|
||||||
|
|
||||||
|
- Namen sind klar und deutlich
|
||||||
|
- inhaltlich korrekt geordnet
|
||||||
|
|
||||||
|
## 2.2.2
|
||||||
|
|
||||||
|
````xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data>
|
||||||
|
<buch>
|
||||||
|
<bibNr> </bibNr>
|
||||||
|
<title> </title>
|
||||||
|
<zustand> </zustand>
|
||||||
|
<seitenanzahl> </seitenanzahl>
|
||||||
|
</buch>
|
||||||
|
<avmedium>
|
||||||
|
<bibNr> </bibNr>
|
||||||
|
<title> </title>
|
||||||
|
<zustand> </zustand>
|
||||||
|
<dauer> </dauer>
|
||||||
|
</avmedium>
|
||||||
|
</data>
|
||||||
|
````
|
||||||
|
|
||||||
|
### 2.3 SQL
|
||||||
|
|
||||||
|
## 2.3.1
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT book.bibNr, book.titel, COUNT(book.bibNr) AS wieOftAusgeliehen
|
||||||
|
FROM buch AS book
|
||||||
|
LEFT JOIN Ausleihe AS rent ON book.bibNr = rent.bibNr
|
||||||
|
AND YEAR(rent.ausleihdatum) = 2015
|
||||||
|
GROUP BY book.bibNr, book.titel
|
||||||
|
ORDER BY wieOftAusgeliehen ASC
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2.3.2
|
||||||
|
|
||||||
|
X
|
||||||
|
|
||||||
|
## 2.3.3
|
||||||
|
|
||||||
|
Gute Frage, frag chatgpt!
|
||||||
Reference in New Issue
Block a user