winmastergames Posted December 11, 2007 Share Posted December 11, 2007 Hi well ive been making a Useful links page thats all working now but i now want a seperate script that lists all the data in a MYSQL database table (name, Url, Description) and has another link so you can delete it (But i want a seperate php script to do this) how should i be able to do this? Here is my PHP script that I have that a got help for to make If you look a index.php below i just want a PHP script like that but it has a button to delete it I know it will be easy because im actually learning MYSQL now and I just want to know how to do Thanks index.php <?php // connect to db // select db $db_host = "HOST"; $db_username = "USERNAME"; $db_password = "PASSWORD"; $db_name = "DATABASE"; $conn = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error()); mysql_select_db($db_name, $conn) or die(mysql_error()); $myquery = mysql_query("select * from TABLE_NAME"); while($r=mysql_fetch_array($myquery)) { $rowname=$r["name"]; // put your field's name is where "their_website" is $rowurl=$r["url"]; // put your field's name is where "their_link" is $rowdescription=$r["description"]; // put your field's name is where "their_description" is echo "$rowname | "; echo "<a href=\"$rowurl\">$rowurl</a> | "; echo "$rowdescription<br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/81104-deleting-selected-mysql-data/ Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 When you echo it out, include the record row number. That way you can generate a URL that contains the row number, and then you can call deleterecord.php?id=1 and that code will delete that particular record. Link to comment https://forums.phpfreaks.com/topic/81104-deleting-selected-mysql-data/#findComment-411528 Share on other sites More sharing options...
winmastergames Posted December 11, 2007 Author Share Posted December 11, 2007 And how will i do that? because im not the best at PHP with MYSQL Link to comment https://forums.phpfreaks.com/topic/81104-deleting-selected-mysql-data/#findComment-411536 Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 First step is learn how to use $_GET Link to comment https://forums.phpfreaks.com/topic/81104-deleting-selected-mysql-data/#findComment-411540 Share on other sites More sharing options...
winmastergames Posted December 11, 2007 Author Share Posted December 11, 2007 Would someone please make up a script so i can learn how it works because im a very fast learning when I can see it Im a visual learner Link to comment https://forums.phpfreaks.com/topic/81104-deleting-selected-mysql-data/#findComment-411637 Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 There are quite a few posts already that show how to do this, all you have to do is search a little. Link to comment https://forums.phpfreaks.com/topic/81104-deleting-selected-mysql-data/#findComment-411651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.