Jump to content

Deleting selected MYSQL data


winmastergames

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.