alphasil Posted November 27, 2014 Share Posted November 27, 2014 Hi I have this function in php file function verAtividadesDocente() { if(!$this->DBLogin()) { $this->HandleError("Erro na ligação à Base de Dados!"); return false; } $image = $iduser = $this->UserId(); $nresult = mysql_query("SELECT t1.idatividade, t1.atividade, t1.data, t1.hora, t1.local,t2.nome FROM atividades t1, utilizador t2 WHERE t2.idutilizador = '$iduser'", $this->connection) or die(mysql_error()); $num_rows = mysql_num_rows($nresult); echo "<table>"; echo "<tr> <td>Nome</td> <td>Data</td> <td>Hora</td> <td>Local</td> <td>Intervenientes</td> <td>Operações</td> </tr>"; while($row = mysql_fetch_assoc($nresult)) { echo "<tr>"; $id = $row['idatividade']; echo "<td>".$row['atividade']."</td>"; echo "<td>".$row['data']."</td>"; echo "<td>".$row['hora']."</td>"; echo "<td>".$row['local']."</td>"; echo "<td>".$row['nome']."</td>"; echo "<td>".'<a href="editaAtividade.php?id=',$id,'"><img src="images/tick.png"></a>'.' / '.'<a href="' . $this->removerAtividade($id) . '";><img src="images/delete.png"></a>'."</td>"; echo "</tr>"; } echo "</table>"; } and my problem is this line echo "<td>".'<a href="editaAtividade.php?id=',$id,'"><img src="images/tick.png"></a>'.' / '.'<a href="' . $this->removerAtividade($id) . '";><img src="images/delete.png"></a>'."</td>"; I have two link with images, but when i load the page i have my database record, if i use refresh the record disapear without using any of those buttons....why? thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/292754-wrong-delete/ Share on other sites More sharing options...
CroNiX Posted November 27, 2014 Share Posted November 27, 2014 $this->removerAtividade($id) Seems like your code is telling it to. It's executing a function here, not creating text for a link href. Quote Link to comment https://forums.phpfreaks.com/topic/292754-wrong-delete/#findComment-1497852 Share on other sites More sharing options...
alphasil Posted November 27, 2014 Author Share Posted November 27, 2014 ok...but how can i fix this? because when i first load the page i have my record in a table, using refresh the record is deleted from the database without using the button. Any suggestion to fix this code? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/292754-wrong-delete/#findComment-1497855 Share on other sites More sharing options...
CroNiX Posted November 27, 2014 Share Posted November 27, 2014 (edited) Put the url to the delete function there, not CALL the actual delete function. Just like you are for the first button on the same line where you give the url to the function, editaAtividade.php?id= Edited November 27, 2014 by CroNiX Quote Link to comment https://forums.phpfreaks.com/topic/292754-wrong-delete/#findComment-1497857 Share on other sites More sharing options...
alphasil Posted November 27, 2014 Author Share Posted November 27, 2014 Thank you....it works now But before moving to another page i would like to stay few seconds with a message to confrim the record has been deleted....it is possible? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/292754-wrong-delete/#findComment-1497859 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.