Freig Posted July 27, 2007 Share Posted July 27, 2007 Hi there. Im trying to make a delete link/funktion in my links section. I have a little PHP experience but not much. my code looks like this: <table width="100%" border="0" cellpadding="0" cellspacing="0"> <b> <td> Linknavn: </td> <td> URL: </td> </b> <?php mysql_connect("x", "xx", "xxx"); mysql_select_db("yyy"); $query = mysql_query("select * from links ORDER BY linknavn ASC"); while ($row = mysql_fetch_array($query)) { echo "<tr align='left'>"; echo '<td>' <? mysql_connect("x", "xx", "xxx"); mysql_select_db("ks1more"); if(!isset($cmd)) { $result = mysql_query("select * from links order by id"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; echo "<a href='delete.php?cmd=delete&id=$id'>Delete</a>"; echo "<br>"; } } ?> <? if($_GET["cmd"]=="delete") { $delid = (int) $_GET["id"]; $sql = "DELETE FROM link WHERE id=$delid"; $result = mysql_query($sql); echo "Row deleted!"; } ?> echo '</td>' echo "<td>". $row["linknavn"] ."</td>"; echo "<td>". $row["links"] ."</td>"; echo "</tr>"; } mysql_close(MYSQL *mysql); ?> </table> It returns a blank code, I cannot find the solution, can you help me please. Quote Link to comment Share on other sites More sharing options...
Freig Posted July 27, 2007 Author Share Posted July 27, 2007 This is a php script(delete) inside an echo. I dont know if that can be done? Quote Link to comment 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.