Boxerman Posted September 30, 2008 Share Posted September 30, 2008 Hi guys, im creating a staking site, and i want to add records of stuff and i want a table like this... Name | Location | Features(then heres the thing i need) |DELETE Test England some text here Delete record test england some other text Delete record for the delete i need something that is by the side of all the entrys on the database so say i had 100 entrys.. i want a delete to show next to every single one... but only entering 1 link in the code.. if you get me thanks all Quote Link to comment https://forums.phpfreaks.com/topic/126416-solved-delete/ Share on other sites More sharing options...
dropfaith Posted September 30, 2008 Share Posted September 30, 2008 if i understand this below will loop the data and form the table and add a link to a delete script when clicked on <?php $query = "SELECT * FROM Art"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?><caption>Artist Profiles</caption> <tr> <td><? echo $row->Name; ?></td> <td class="editdel"><a href="deleteartist.php?Name=<? echo $row->Name; ?>">Delete Artist</a></td> </tr> <? } } // if no records present // display message else { ?> <? } // close database connection mysql_close($connection); ?> this is a basic delete script you will need to edit both of these as they are geared and set up to my tables on one of my sites <?php // includes include("../template/conf.php"); // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $Id = mysql_escape_string($_GET['Id']); mysql_query("DELETE FROM story WHERE Id = '$Id'") or die(mysql_error()); ?> hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/126416-solved-delete/#findComment-653696 Share on other sites More sharing options...
Boxerman Posted September 30, 2008 Author Share Posted September 30, 2008 is there not a simple one... like Delete record *textbox* and a sumbit button ? Quote Link to comment https://forums.phpfreaks.com/topic/126416-solved-delete/#findComment-653697 Share on other sites More sharing options...
Boxerman Posted September 30, 2008 Author Share Posted September 30, 2008 thanks all for your help! fixed myself! Quote Link to comment https://forums.phpfreaks.com/topic/126416-solved-delete/#findComment-653698 Share on other sites More sharing options...
fenway Posted October 2, 2008 Share Posted October 2, 2008 thanks all for your help! fixed myself! How? Enlighten us. Quote Link to comment https://forums.phpfreaks.com/topic/126416-solved-delete/#findComment-655284 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.