473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Deleting database entrys from a website

Hello, I am trying to delete entries from my database via a website with a button and at the moment it is deleting entries without the click of the button

Expand|Select|Wrap|Line Numbers
  1.           <?php
  2.           if(isset($_POST['submit']))
  3.           {
  4.         echo "Delet button pressed";
  5. $con = mysql_connect("localhost","blah","blah");
  6. if (!$con)
  7.   {
  8.   die('Could not connect: ' . mysql_error());
  9.   }
  10.  
  11. mysql_select_db("cfarmer_comp4", $con);
  12.  
  13. mysql_query("DELETE FROM Requests WHERE ListenerName = 'steve' ");
  14.  
  15. mysql_close($con);
  16. }
  17. ?> 
  18.  
  19.  
  20.  
  21.  
  22.  
  23.       </p>
please please please help
Apr 8 '11 #1
1 1287
JKing
1,206 Expert 1GB
Hello. Without seeing the HTML this is only a guess.

My assumption is that you have a submit button named "submit".

Submit buttons use the value parameter for their text. Therefore $_POST['submit'] is always set and your function executes on every page load.

But that is just a guess, please provide the HTML that goes along with your code.
Apr 8 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt O'Toole | last post by:
I'm looking for a website backend. I can use PHP and other scripting languages, but I don't have access to an RDBMS. So I'm looking for an RDBMS substitute -- maybe something that reads/writes...
0
by: ssp2000 | last post by:
We want to develop database driven website. because of enormous amount of data (300GB) customers's tech advisors are insisting on using SAN instead of any direct attached storage method. I want...
1
by: Jake Henderson | last post by:
I am developing apps in VWD Express and SQL Svr 2005 Express. I currently have a web server running Win2K3 SBS W/IIS V.6.0 & ASP.NET 2.0. I am currently using a test site that is only availible on...
4
by: kanley | last post by:
I have an access database and I would like to put this database onto a website for users to query/search information. I know i can use php with MySQL, but I am not very familiar with those. Does...
4
by: RAB | last post by:
I am building an e-commerce website with Asp.net 1.1. I don't expect a high volume of sales at first (probably less than 10 sales per day). The daily page visits at first will be slow (probably...
1
by: david stradling | last post by:
If I delete records, then add other ones, the new records are entered in place of the old ones. I want the new records to appear last. For example, say I had records number 1 through 5 and...
6
by: sravan_reddy001 | last post by:
I am creating a website. where the data to be stored in my server. I had my webspace from some service provider. How can i connect the website and thee database. --website is deployed at webspace...
25
by: pereges | last post by:
Hello, I'm trying to build a database driven website for a library management system. The database is stored on a remote server which all of my team mates can access. I've installed MySQL, PHP and...
3
by: SAMI2 | last post by:
Hi I have create database by MSaccess in the my computer and I need publish on the Internet to use direct from website. the database contain tables, queries and forms that is as application. I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.