Solved: Delete MYSQL Rows

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

bob121

Thread Starter
Joined
Sep 10, 2006
Messages
207
Hello,

I was woundering if someone could help me out ,,

what i would like is a script that:

Connects to MYSQL

Accesses my gbook table

Displays A List In PHP Of All The Entrys

And A Delete Button Next To Each one Or When You Click On The Item To Delete The Row

Info You Will Need

DB NAME = carsey_guestbook
UserName = carsey_carsey
password = i will enter that just put in its place "password"

Name Of Items In Row:
Name
Email
Post

I Have Made A Script Like This Before But Can't Seem To Make Them Now , I Believe Its Fairly Easy If You Have An Idea In PHP.

Thanks In Advance James


Also if you do require any extra infomation please do request it.
 

bob121

Thread Starter
Joined
Sep 10, 2006
Messages
207
I Have Done This So Far , Not Completly working tho:
It displays each Post and it says i have deleted it when i click on it but dosnt attucaly delete it.
can anyone see an error

Code:
<?
switch($_GET['do']) {
default:

$gbook = mysql_query("SELECT * FROM `gbook` ORDER by `name` ASC");
while($n=mysql_fetch_array($gbook)) {
echo("<b>ID:</b> $n[ID]<br/>
    <b>Name:</b> $n[name]<br/>
	<b>Email:</b> $n[email]<br />
	<b>Post:</b> $n[post]<br/>
	<b>Action:</b> <a href=\"gbook.php?do=del&book=$n[ID]\">Delete</a><br/> <br>");
}

break;

case "del" :
	$id = $_GET[book];
	$obtainbooks = mysql_query("SELECT * FROM `gbook` WHERE `ID`= '$ID'");
	$gb = mysql_fetch_array($obtainbooks);
echo ("You've deleted the entry");
	    mysql_query("DELETE FROM `gbook` WHERE `ID` = '$gb[ID]'");
break;
}
?>
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top