Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "127.0.0.1";
- $username = "dylan326";
- $password = "";
- $dbname = "questions87";
- $port = 3306;
- $conn = mysqli_connect($servername, $username, $password, $dbname,
- $port);
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- echo "<a href='index.html'> Log out </a><br>
- <a href='ask.php'> Ask a question</a><br>
- <br />
- <br />";
- echo "Answer another users question: <br><br />";
- $sql = "SELECT q_id,question, username FROM questions";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- while($row = mysqli_fetch_array($result))
- {
- $q_id = $row['q_id'];
- $question = $row['question'];
- $username = $row['username'];
- //right here I need to add(concat) the second variable $username to
- //these links forthe next page but nothing I have tried has worked
- echo ('<a href="totalqs.php?q_id=' . $q_id .' " >' . $question .
- '</a>' . '<br>');
- }
- } else {
- echo "0 results";
- }
- mysqli_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement