I am trying to make a simple project of DB to my school. I am occuring strange kind of error. When I am getting the external name from HTML input to select query, I always lose 1 result. I am trying to make DELETE from my PHP interface but I can only do it when there are more than 1 same records. I don't have any ideas how to fix it.
look into code
I tried to make integer which gets value from HTML name and then includes it in the query but nothing happened
Into PHP:
echo" <form name='display' action='delete.php' method='POST' >
<li>ID Dłużnika:</li>
<li><input type='number' name='indeks' /></li>
<li><input type='submit' name='submit' /></li>
<li><input type='submit' name='new' /></li>
</form>
";
$db = pg_connect("host=localhost dbname=dluznicy user=pdacko password=elowariat");
$result = pg_query($db, "SELECT imie,nazwisko,indeks,miejsce_zamieszkania,kwota_zadluzenia FROM spis_dluznikow where indeks = $_POST[indeks] ");
$row = pg_fetch_assoc($result);
if (isset($_POST['submit'])){
.
.
.
while ($row = pg_fetch_assoc($result)){
Expected is error at
$result = pg_query($db, "SELECT imie,nazwisko,indeks,miejsce_zamieszkania,kwota_zadluzenia FROM spis_dluznikow where indeks = $_POST[indeks] ");
Where I lose 1 record and can only see where there are more than 1 with the same index(ID)