Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-29-2008, 02:23 AM   #1
LQ Newbie
Registered: Dec 2008
Posts: 3

Rep: Reputation: 0
My SQL statement to delete an entry in MYSQL database fails in PHP

I have a small application i named student admin. I have the following entries in the mysql database, table called 'student':

Students Registry

Foster Johns 1 2002
Edwin Zvav 2 1998
Chenai Mutande 23 2008

Regnumber is my primary key in the database. I pass the regnumber as a parameter from one page to the page that executes a sql statement to delete a student whose regnumber would have been parsed. The page, deleteStudent.php is as follows:

Students Admin:: Student deletion...


include_once "config.php";
include_once "opendb.php";

//verifying the parsed parameter.
echo $myID;
$query = "delete from student where Regnumber = '$myID'";

//echoing the query that will be run
echo $query;


<p> </p>
<p align="center">Student with Registration <i><?php echo $myID ?></i> has been successfully removed from registry! <input type="button" name="backr" value="Home" onclick="window.location.href='http://localhost'" style="height:2em; width:8em;"></P>


When i run the above php page the $myID is echoed correctly and if, for instance i intend to delete student with regnumber '1', the sql statement is echoed as: delete from student where Regnumber = '1'

I am surprised because when i go on to view all the students in registry, EVEN THE DELETED STUDENT IS STILL THERE!!!! If someone willing to assist has additional info he needs, am ready to provide for this seemingly simple problem.....
Old 12-29-2008, 02:48 AM   #2
Registered: Aug 2007
Location: Cochin, Kerala, India
Posts: 32

Rep: Reputation: 3
Change $result=mysql_query(query); to $result=mysql_query($query)or die("Error");


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Protecting your MySQL database from SQL injection attacks with GreenSQL LXer Syndicated Linux News 0 08-25-2008 07:00 PM
Snort database growing large; how to use mysql to delete? logicalfuzz Linux - Software 1 01-12-2006 06:14 PM
php trying to connect to local sql, error no such database feetyouwell Programming 11 02-08-2005 12:25 PM
mysql sql statement help mrtwice Programming 4 12-02-2003 10:04 AM
SQL mySQL PHP and Sessions poeta_boy Programming 15 11-26-2003 06:36 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration