Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "mysql-server-1.macs.hw.ac.uk";
- $username = "cam2";
- $password = "abccam2354";
- $dbname = "cam2";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- div.container {
- width: 100%;
- border: 1px solid gray;
- }
- header, footer {
- padding: 1em;
- color: white;
- background-color: blue;
- clear: left;
- text-align: center;
- }
- nav {
- float: left;
- max-width: 160px;
- margin: 0;
- padding: 1em;
- }
- nav ul {
- list-style-type: none;
- padding: 0;
- }
- nav ul a {
- text-decoration: none;
- }
- article {
- margin-left: 170px;
- border-left: 1px solid gray;
- padding: 1em;
- overflow: hidden;
- }
- * {
- box-sizing: border-box;
- }
- #count {
- background: #9F0;
- width: 10%;
- height: 100px;
- text-align: center;
- line-height: 100px;
- font-size: 64px;
- margin: 0;
- border: 3px solid green;
- border-radius: 5px;
- }
- .button {
- background: #09F;
- width: 5%;
- height: 50px;
- text-align: center;
- line-height: 50px;
- font-size: 32px;
- border: 3px solid blue;
- border-radius: 5px;
- }
- .button, #count {
- float: left;
- }
- #minus {
- margin: 25px 2.5% 0 37.5%;
- }
- #plus {
- margin: 25px 37.5% 0 2.5%;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <header>
- <h1>Calum's Really Shitty Website</h1>
- </header>
- <nav>
- <ul>
- <li><a href="#">Athletics</a></li>
- <li><a href="#">Football</a></li>
- <li><a href="#">Snooker</a></li>
- </ul>
- </nav>
- <article>
- <h1>All Q&A's</h1>
- <p>Add New Movie</p>
- <form method = "post">
- </p>
- <input type="hidden" name="user" size="15"
- maxlength="30" value = "<?php echo $user ?>"/>
- <input type="hidden" name="pass" size="15"
- maxlength="30" value = "<?php echo $pass ?>"/> </p>
- <button id = "button" type="button">Ask Question</button>
- </br></br>
- <div id = "id1" style="display: none;">
- <p>Title</p>
- <textarea id = "questiontitle" name="questiontitle" cols="60" rows="1"></textarea>
- <p>Question Type</p>
- <textarea id="Question Type" name="questiontype"></textarea>
- </br><p>Question</p>
- <textarea id = "questionarea" name="questionarea" cols="60" rows="10"></textarea></br>
- <input type="hidden" name="questionType" id="questionType" value= "HTML" />
- <input type="submit" name="submitquestion" class = "submitquestion"
- value="Submit" />
- <br>
- <p class="button" id="minus">-</p>
- <p id="count">0</p>
- <p class="button" id="plus">+</p>
- <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
- <script >
- var counter = 0;
- $("#plus").click(function(){
- counter++;
- $("#count").text(counter);
- });
- $("#minus").click(function(){
- counter--;
- $("#count").text(counter);
- });s
- </script>
- </div>
- <script>
- var button = document.getElementById('button');
- button.onclick = function() {
- var div = document.getElementById('id1');
- if (div.style.display !== 'none') {
- div.style.display = 'none';
- }
- else {
- div.style.display = 'block';
- }
- };
- </script>
- </div>
- </form>
- <?php
- session_start();
- $userIDs = array();
- $movieIDs = array();
- $index = -1;
- //$user = $_POST['user'];
- //$pass = $_POST['pass'];
- $result = mysqli_query($conn, "SELECT *
- FROM Answers");
- while($row = mysqli_fetch_array($result)) {
- $index = $index + 1;
- echo "<br/><br/>";
- echo "<p id = '" . $row["QuestionsID"] . "a'> <b> Title : </b>" . $row["Question"]. "<b> Genre : </b> " . $row["Answer"]. "<b> Rating: </b>" . $row["Type"]. "</p>";
- //<p class="button" id="minus">-</p> //////was wanting to echo that everytime when i get a ebtry in database <-------
- //<p id="count">0</p>
- //<p class="button" id="plus">+</p>
- }
- echo "</br></br>";
- ?>
- </article>
- <footer>Calum McLean</footer>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement