如何从数据库条目创建永久可访问的URL?

I am trying to make a mirror of the this site for my own country, but I am having a hard time comperehending how to create new urls from my database entries.

For example as on the site I linked, it has and id/name to identify that exacty site, i want to achieve the same to make seperate questions shareable.

My current code is only created to test with 1 question on localhost url.

Here's a little snippet of what I've currently got:

    <?php
    $id = 1;
    $result = performQuery("SELECT * FROM dilemmas WHERE id = ".$id);
    while($row = mysqli_fetch_array($result)){
        $blue_question = utf8_encode($row['blue_question']);
        $blue_votes =  utf8_encode($row['blue_votes']);
        $red_question = utf8_encode($row['red_question']);
        $red_votes = utf8_encode($row['red_votes']);
    }
    ?>

<div class="answer-peek">
    <div class="peek-text">Vil du helst...</div>
    <div class="peek-buttons">
        <div class="peek-bluebutton"><?php echo $blue_question ?></div>
        <div class="peek-redbutton"><?php echo $red_question ?></div>
    </div>
</div>
<div class="row text-center" id="textrow">
    <h3 style="color:white;">Vil du helst...</h3>
</div>
<div class="row" id="buttonrow">
<div class="col-md-1">
    <div class="button-left"></div>
</div>
<div class="col-md-10"><
    <div class="col-md-5 col-md-offset-1 button" id="bluebutton">
    <div class="blueCheckDiv"></div>
        <div id="text-container">
            <table cellpadding="0">
                <tbody>
                    <tr>
                        <td valign="middle">
                            <div class="result">
                                <div class="percentage">
                                    <?php
                                    $percent = $blue_votes/($blue_votes + $red_votes);
                                    $percent_friendly = number_format( $percent * 100, 0 ) . '%';
                                    echo $percent_friendly;
                                    ?>
                                </div>
                                <div class="total-votes">
                                <span class="count">
                                <?php echo $blue_votes; ?>
                                </span>
                                <span class="word">
                                    enige
                                </span>
                                </div>
                                <div class="question-text">
                                <?php echo $blue_question ?>
                                </div>
                            </div>
                            <p class="question">
                            <?php echo $blue_question ?>
                            </p>
                        </td>
                    </tr>
                </tbody>
            </table>

        </div>
    </div>
    <div class="col-md-5 button" id="redbutton">
    <div class="redCheckDiv"></div>
        <div id="text-container">
            <table cellpadding="0">
                <tbody>
                    <tr>
                        <td valign="middle">
                            <div class="result">
                                <div class="percentage">
                                    <?php
                                    $percent = $blue_votes/($blue_votes + $red_votes);
                                    $percent_friendly = number_format( $percent * 100, 2 ) . '%';
                                    echo $percent_friendly;
                                    ?>
                                </div>
                                <div class="total-votes">
                                <span class="count">
                                    <?php echo $red_votes ?>
                                </span>
                                <span class="word">
                                    uenige
                                </span>
                                </div>
                                <div class="question-text">
                                    <?php echo $red_question ?>
                                </div>
                            </div>
                            <p class="question">
                            <?php echo $red_question ?>
                            </p>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    </div>
    <div class="col-md-1">
        <div class="button-right"></div>
    </div>
</div>

<div class="row" id="dividerrow">
    <div class="col-md-8" id="divider-left"></div>
    <div class="col-md-4" id="divider-right"></div>
</div>

<div class="row" id="socialrow">
    <div class="col-md-8 socialcol" id="col-left"></div>
    <div class="col-md-4 socialcol" id="col-right"></div>
</div>

I suggested you to use a framework in the comments to your question.

Anyway, to do what you are trying, you can try something like this:

<?php
$id = 1;
if (true === isset($_GET['id'])) {
    $id = $_GET['id'];
}

$result = performQuery("SELECT * FROM dilemmas WHERE id = ".$id);
while($row = mysqli_fetch_array($result)){
    $blue_question = utf8_encode($row['blue_question']);
    $blue_votes =  utf8_encode($row['blue_votes']);
    $red_question = utf8_encode($row['red_question']);
    $red_votes = utf8_encode($row['red_votes']);
}

And you can call this same page with something like example.com/page.php?id=1234.

So, you can build links for each question like this:

<a href="/page.php?id=<?php echo $row['id']; ?>">Share</a>

NOTE: This is a really dirty code and it opens to a lot of security issues. I wrote it only to make you able to understand the dynamics, but, again, I suggest you to use a framework on the first start: make all in "plain" PHP will cause you to deal with a lot of complex problems like the security or the handling of routing or services, etc... Use a framework to find very good guidance and to learn faster and better the language of your choice (PHP in this case).