noclist Posted November 16, 2010 Share Posted November 16, 2010 I am building a user interface to manipulate a database I have in mySQL and one of the functions is deleting records from a table I call Titles. Given my primary key is mID and a column in the table is Title, here is the code I'm working with: $sql="delete from myDb.Titles where mID=" . $_GET['mID']; if (mysql_query($sql)) { $target="delete.php?"; } echo "Successfully deleted title: " . $_GET['Title']; The actual delete itself is working fine and the record deletes properly. What I am trying to do is display the Title field associated with the record being deleted and it's not working. I don't know if I am misusing the GET function or not, but that's where I am. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 16, 2010 Share Posted November 16, 2010 Unless you have a variable appended to the URL called 'Title' that actually holds the value of the title (such as script.php?id=123456&Title=sometitle) then yes, you are using it incorrectly. You'd need to run a SELECT query first (possibly in the same script that gets the PK id) to retrieve the value of the Title field from the record, then echo it after the DELETE query. Quote Link to comment Share on other sites More sharing options...
noclist Posted November 16, 2010 Author Share Posted November 16, 2010 Thanks so much, I got it worked out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.