0

How can I delete from a table where id= $row['id']. ? From php

firs I do mysqli_query($connect, "SELECT* FROM table"); I put it in an array i.e. $row I echo a table with the datas. I create delete button in each row. What I want to do is: when I click the button in one of the table rows, that row will be deleted. When I try: &datas = mysqli_query($connect, "SELECT* FROM table"); while ($row = mysqli_fetch_assoc($datas)) { //here I make the table in HTML and echo $row elements if(filter_input(INPUT_POST, 'delete')) // the name of button

18th Feb 2017, 8:54 AM
Brigitta
3 odpowiedzi
0
{ mysqli_query($connect, "DELETE id FROM table WHERE id = // and here is where i stucked. if I write $row['id'] I got an error, as soon as I put the [ ] . when I write id= (filter_input(INPUT_POST, 'delete')) it doesn't do anything. Can someone help and explane what is wrong?
18th Feb 2017, 8:59 AM
Brigitta
0
Hi Moksh Makhija, IT'S WORKING!!!!! Thank you so much! I spent the whole day yesterday to find the solution... Can you explane the 2 dots and the empty quotation mark? Am I right when I suppose the dots ar to concatenate? And what about the quotation mark?
18th Feb 2017, 1:15 PM
Brigitta