Skip to content Skip to sidebar Skip to footer

Get Information From Database

When I click on artikle It needs to diretct me to page.php where I display whole article. Problem is im not sure how to with $_GET superglobal var properly take information. I have

Solution 1:

$row_id = $row['id'];
echo '<a href="clanak.php?id='.$row_id.'" class="form-field-textual">some text</a>';

        <?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);
    }

      $id = isset($_GET['id']) ? (int)$_GET['id'] : '';

    $sql = "SELECT * FROM projekt WHERE id = $id";

    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();

Post a Comment for "Get Information From Database"