diff --git a/functions.php b/functions.php index 7ce5dae..05ed8f8 100644 --- a/functions.php +++ b/functions.php @@ -97,30 +97,35 @@ function post_demand () // A function to insert the own posts from the database into the website function get_demand_titles () { - global $con; - $sql = "SELECT * FROM demands"; - $result = mysqli_query($con, $sql); - while ($row = $result->fetch_assoc()) { - echo "

"; - echo "" . $row['demandTitle'] . - "" . "
"; - echo $row['date'] . "
"; - echo "

- - -
+ global $con; + $sql = "SELECT * FROM demands"; + $result = mysqli_query($con, $sql); + while ($row = $result->fetch_assoc()) { + echo "

"; + echo "" . $row['demandTitle'] . "" . "
"; + echo $row['date'] . "
"; -

- - - - - - - -
-
"; + echo "
+ + +
"; + + echo "
+ + +
"; + + echo "
+ + + + + + + +
+
"; } } @@ -167,4 +172,35 @@ function delete_demand() } } +function show_demand () +{ + global $con; + $demandId = $_POST['demandId']; + + $demand_query = "SELECT * FROM demands where demandId='$demandId'"; + $demand_query_result = mysqli_query($con, $demand_query) or + die(mysqli_error($con)); + $demand_rows = $demand_query_result->fetch_object(); + + $qualityId = $demand_rows->qualityId; + $quality_query = "SELECT * FROM quality where qualityId='$qualityId'"; + $quality_query_result = mysqli_query($con, $quality_query) or + die(mysqli_error($con)); + $quality_rows = $quality_query_result->fetch_object(); + + echo "

" . $demand_rows->demandTitle . "

"; + echo "
+
"; + echo "Maximum required pieces: " . $demand_rows->piecesMax; + echo "
+
"; + echo "Minimumrequired pieces: " . $demand_rows->piecesMin; + echo "
+
"; + echo "Quality: " . $quality_rows->qualityName; + echo "
+
+ Description:
"; + echo $demand_rows->demandText; +} ?> diff --git a/show_demand.php b/show_demand.php new file mode 100644 index 0000000..fc4c804 --- /dev/null +++ b/show_demand.php @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +
+
+ + + + +
+
+ +

+ +

+ +