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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.