MySQL Forums :: PHP :: delete query doesnt work with php


Advanced Search

delete query doesnt work with php
Posted by: Abhinav Trivedi ()
Date: March 28, 2009 07:05AM

I have a very peculiar problem. I have an app with an 'Edit' and 'Delete' button displayed for every record. Edit basically deletes the old record and inserts a new one whereas Delete just removes the record from database.

The problem is that while pressing Delete button the old record does not get deleted. The same record gets deleted when user clicks Edit button.

Now comes the most interesting part, both these functionalities use the same function for deleting the record.

---
function deleteRecord($userID,$activity,$refNo,$descr,$requestBy,$date)
{

$query = "delete from Timesheet where UserID='$userID' and tDate ='$date' and Activity='$activity' and RefNo='$refNo' and Description='$descr' and RequestBy='$requestBy'";
$result=getSQL($query);
if($result==1){
$result = getSQL("commit");
}
return $result;
}

getSQL() is a just a simple function i use to create the db connection and run the query, no logic there.
---

I also tried printing the delete query generated and ran the same manually and it works fine. Any clues?

Options: ReplyQuote


Subject Written By Posted
delete query doesnt work with php Abhinav Trivedi 03/28/2009 07:05AM
Re: delete query doesnt work with php Rick James 03/29/2009 09:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.