SELECT baza WHERE owner='bako' else owner='0'
I would like to see a listing of all the jobs not yet assigned to an owner, but once I choose one of them and I refresh the page I would like to see only the one I chose.
Something similar to this:
SELECT baza WHERE owner='bako' else owner='0'
Right now I have this:
$sql = "SELECT * FROM baza WHERE owner='0' ";
but I want like this:
$username = $_SESSION['username'];
$sql = "SELECT * FROM baza WHERE owner='$username' else owner='0'";
This is my PHP
<?php
header("charset: UTF-8");
$conn = mysqli_connect("localhost", "root", "", "dam");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$username = $_SESSION['username'];
$sql = "SELECT * FROM `baza` WHERE owner='0' ";
mysqli_set_charset($conn, "utf8");
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo
"
<br><br><br> <br><br>
<div id='names_bord'>
<div id='names_name'> name: " . $row["saxeli"] . " </div>
<div id='names_price'> price: " . $row["tanxa"] . " </div>
<div id='names_a'> city: " . $row["qalaqi"]. " " . $row["misamarti"]. "</div>
<div maxlength='10' id='names_a'> comment: " . $row["komentari"]. " </div>
<div id='names_accept'><a href=\"detail - Copy.php?id=".$row['id']."\"><img src='infoicon.png' ></i></a></div>
</div>
";
}
} else {
echo "0 results";
}