I want to select a value from the database with variables I get from $_GET, but it doesn't show any results. Could any one help me find what is wrong with my code?
here is my first page how i get the value to GET:
<?php
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<tr>
<td><a href="file.php?subject=<?= $row['subject'] ?>"><?= $row['subject'] ?></a></td>
<td><?= $row['location'] ?></td>
<td><?= $row['geo'] ?></td>
<td><?= $row['date'] ?></td>
<td><?= $row['piority'] ?></td>
</tr>
<?php
}
}
?>
and here is my second page that i want to get data from database with subject variable from first page:
<?php
$varPage = $_GET['subject'];
$servername = "localhost";
$username = "bayansh_user";
$password = "u)nHf,Accmo)";
$dbname = "bayansh_bmc";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$result = mysqli_query($conn,"SELECT `date` FROM `editor` WHERE subject = '.$varPage.'");
while($row = mysqli_fetch_array($result))
?>
and now i want to write the date here is my code:
<p style="font-family:B Zar; direction:rtl; font-size:165%;"> <?= $row['date'] ?> </p>
but it writes nothing. Is there anything wrong with my code?