Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Adding an MySQL command to a link?
Old 02-15-2008, 04:18 PM Adding an MySQL command to a link?
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Hiya

could you tell me the best way to do this please

I want to have a link or preferably a button with the word ""delete"" on it that when pressed does this command..
mysql_query("DELETE FROM messages WHERE ID= '$query'") or die(mysql_error());


I know how to use buttons and links with url links but can't seem to find how to add a MySQL command instead of the link :-(

Can you help please?

Thanks

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-15-2008, 05:28 PM Re: Adding an MySQL command to a link?
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
I don't really understand what you're saying completely.. Are you asking how to run a MySQL command without having to load a new page? Well just like I suggested in your last post Learn AJAX.
http://www.w3schools.com/ajax
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 02-15-2008, 06:12 PM Re: Adding an MySQL command to a link?
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
lol, you seem to like your ajax

hmmmm how can i put this simple

a link normally is used to take you to another page

i don't want it to do that, i want it to do this

mysql_query("DELETE FROM messages WHERE ID= '$query'") or die(mysql_error());

ajax isn't needed for this i do know that much lol

any help would be very much appreciated.

thanks

shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-15-2008, 06:20 PM Re: Adding an MySQL command to a link?
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Worked it out now thanks

was simple..

have a link take me to a new page

new page deletes the message with
mysql_query("DELETE FROM messages WHERE ID= '$query'") or die(mysql_error());

then says successfully deleted

then go back with continue

see no ajax lol

thanks

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-15-2008, 07:28 PM Re: Adding an MySQL command to a link?
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
AJAX would have been the way to go for this one... there are ways around it, like the one you used, but using AJAX would have a better result
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-15-2008, 10:23 PM Re: Adding an MySQL command to a link?
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
I'm sorry but you clearly said you didn't want to go to a new page.. Then you said the solution was to go to a new page. Following what you stated AJAX WAS the only way to go. Please clearly understand what you want next time :S.
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 02-15-2008, 11:54 PM Re: Adding an MySQL command to a link?
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Quote:
Originally Posted by Mattmaul1992 View Post
I'm sorry but you clearly said you didn't want to go to a new page.. Then you said the solution was to go to a new page. Following what you stated AJAX WAS the only way to go. Please clearly understand what you want next time :S.
LoL

have you never changed your mind?
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-16-2008, 02:13 AM Re: Adding an MySQL command to a link?
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
Lol I guess I am known to do that quite a bit :P. Just thought you where really set on it :S.. Cuz I thought that was the whole problem cuz otherwise it was all basic stuff people should have learned in chapter 1 in their PHP books lol. Good luck .
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 02-16-2008, 02:48 AM Re: Adding an MySQL command to a link?
rion's Avatar
Experienced Talker

Posts: 31
Name: Rion
Location: Portland, Oregon
Trades: 0
there are php books? lol
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
rion is offline
Reply With Quote
View Public Profile Visit rion's homepage!
 
Old 02-16-2008, 08:29 AM Re: Adding an MySQL command to a link?
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Quote:
Originally Posted by Mattmaul1992 View Post
Lol I guess I am known to do that quite a bit :P. Just thought you where really set on it :S.. Cuz I thought that was the whole problem cuz otherwise it was all basic stuff people should have learned in chapter 1 in their PHP books lol. Good luck .

Now this is a problem with me

unless i am having hands on experience my brain just won't digest it, reading a book or starting with real simple little scripts i find just to boring and forget it as i do it..
but doing what i am doing by writing a whole community site.. and never using php at all before i am forcing myself to learn quick hehe
just some of the "basic stuff" i am still having to pick it up o the way
Hope that makes sense

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Adding an MySQL command to a link?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31464 seconds with 12 queries