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>"; } ?> Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. 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.