当我单击artikle时,需要将我定向到page.php,在其中显示整篇文章。 问题是我不确定如何使用$ _GET superglobal var正确获取信息。我必须用$ _GET获取ID。
我已经在index.php中包含了数据库,其中显示了几篇文章。
我正在这样发送ID:
echo '<a href="clanak.php? class="form-field-textual" id='.$row['id'].'">';
// article.php
<?php
$servername = "localhost:3306";
$user = "root";
$pass = "";
$dbo = "projekt";
// Create connection
$conn = new mysqli($servername, $user, $pass, $dbo);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM projekt";
if ($conn->query($sql)===TRUE) {
$specID=$conn->insert_id;
echo "id: " . $row["id"]. " - Name: " .
$row["kategorija"]. " " . $row["naslov"]. "<br>";
} else {
echo "0 results";
}
$conn->close();
?>
答案 0 :(得分:-1)
datestamp | number
2019-01-01 1
2019-01-02 1
2019-01-03 2
2019-01-04 0