There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Delete MYSQL Rows


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
bob121's Avatar
Senior Member with 172 posts.
 
Join Date: Sep 2006
06-Jul-2007, 03:14 PM #1
Question Solved: Delete MYSQL Rows
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's Avatar
Senior Member with 172 posts.
 
Join Date: Sep 2006
06-Jul-2007, 04:36 PM #2
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;
}
?>

Last edited by bob121 : 07-Jul-2007 01:40 PM.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:06 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.