diff --git a/Website/dblogin.sql b/Website/dblogin.sql index df67f03..be87c8a 100644 --- a/Website/dblogin.sql +++ b/Website/dblogin.sql @@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `bsldb`.`nachfrager` ( `erfassungs_id` int(11) NOT NULL AUTO_INCREMENT, `benutzer_id` int(11) NOT NULL, `nachfr_typ` varchar(35) NOT NULL, - `nachfr_quali` tinyint(2) NOT NULL, + `nachfr_quali` tinyint(2) NOT NULL, `nachfr_menge` int(11) NOT NULL, `nachfr_lieferdatum` date, `nachfr_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -47,7 +47,8 @@ CREATE TABLE IF NOT EXISTS `bsldb`.`anbieter` ( `benutzer_id` int(11) NOT NULL, `erfassungs_id` int(11) NOT NULL, `angebot_preis` DECIMAL(7,2) NOT NULL, - `angebot_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `angebot_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `angebot_file` varchar(63) NOT NULL, PRIMARY KEY (`angebot_id`), FOREIGN KEY (`benutzer_id`) REFERENCES `benutzer` (benutzer_id), FOREIGN KEY (`erfassungs_id`) REFERENCES `nachfrager` (erfassungs_id) diff --git a/Website/profile.php b/Website/profile.php index e6c656e..1606fa0 100644 --- a/Website/profile.php +++ b/Website/profile.php @@ -1,5 +1,4 @@ execute(array(":user_id"=>$user_id)); $userRow=$stmt->fetch(PDO::FETCH_ASSOC); - ?> @@ -33,13 +31,13 @@ Lieferung Angebot Alle Angebote vom Günstigsten zum Teuersten - query(" SELECT * FROM nachfrager LEFT JOIN anbieter ON nachfrager.erfassungs_id = anbieter.erfassungs_id WHERE nachfrager.benutzer_id = $user_id - ORDER BY anbieter.angebot_preis ASC + ORDER BY nachfrager.nachfr_typ ASC, anbieter.angebot_preis ASC ") as $row) { echo "" . @@ -55,20 +53,30 @@ }else{echo "k.A." . " " . ""; } - if (!empty(htmlentities($row['angebot_preis']))) { + if (!empty(htmlentities($row['angebot_file']))) { echo "" . - "
" . - "" . - "" . + "" . + "" . "
" . - "" . - ""; - } else { - "" . "" . - "" . + ""; + } + if (!empty(htmlentities($row['angebot_preis'])) AND empty(htmlentities($row['angebot_file']))) { + echo + "" . + "
" . + "" . + "" . + "
" . + ""; + } ""; - } + } + + } catch (Exception $e) { + + echo $e->getMessage(); + echo $e; } ?> diff --git a/Website/suche.php b/Website/suche.php index 41e776d..2bc70d0 100644 --- a/Website/suche.php +++ b/Website/suche.php @@ -21,11 +21,11 @@ if (isset($_GET['keywords'])) { WHERE nachfr_typ LIKE '%{$keywords}%' OR nachfr_beschr LIKE '%{$keywords}%' "); -} else { +} else { $query = $db->query(" SELECT * FROM nachfrager - "); + "); } ?> @@ -43,9 +43,9 @@ if (isset($_GET['keywords'])) {

Suchen Sie ein Teil?

grenzen Sie die Liste ein:

-
" > - - + " > + +
@@ -66,7 +66,12 @@ if (isset($_GET['keywords'])) { "" . htmlentities($row['nachfr_menge']) . " " . "" . "" . htmlentities($row['nachfr_quali']) . " " . "" . "" . htmlentities($row['nachfr_lieferdatum']) . " " . "" . - "" . " Details --> " . "" . + "" . + "
" . + "" . + "" . + "
" . + "" . ""; } } diff --git a/Website/xml2.php b/Website/xml2.php index 8faa30d..4b1dd1f 100644 --- a/Website/xml2.php +++ b/Website/xml2.php @@ -15,6 +15,10 @@ if (isset($_GET['angebot_id'])) { echo "ein problem ist aufgetreten."; break; } +//filename and path +$path="xml/"; +$file="angebot_" . $_GET['angebot_id'] . ".xml"; + //add root == artikel $artikel = $dom->appendChild($dom->createElement('artikel')); while ($result_array = $query->fetch(PDO::FETCH_ASSOC)) { @@ -22,7 +26,6 @@ while ($result_array = $query->fetch(PDO::FETCH_ASSOC)) { foreach($result_array as $key => $value) { //$key holds the table column name - //add track element to jukebox $keys = $dom->createElement($key,$value); $artikel->appendChild($keys); @@ -33,6 +36,29 @@ $dom->formatOutput = true; // set the formatOutput attribute of domDocument to t // save XML as string or file $test1 = $dom->saveXML(); // put string in test1 -echo $test1; -//$dom->save('test1.xml'); // save as file +//echo $test1; +$dom->save($path.$file); // save as file + +// Filepath wird in Datenbank gespeichert +if($file=="") { + $error[] = "es ist was mit dem Filepath falsch gelaufen."; +} else { +try{ + $query = $db->query(" + UPDATE anbieter + SET angebot_file='$file' + WHERE angebot_id='$angebot_id' + "); + /*** close the database connection ***/ + //$db = null; + } catch(PDOException $e) { + echo $e->getMessage(); + } + $error[] = "Ihr Angebot ist nun über den Link nun bereitgestellt"; +} + +// Redirect to this page. + header("Location: " . "profile.php"); + exit(); + ?>