GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Jul-2003, 21:49
skyloon skyloon is offline
Junior Member
 
Join Date: Jun 2003
Posts: 53
skyloon is an unknown quantity at this point

select & delete mysql queries


i've try to insert and delete record at the same page, but it only can insert and can't delete the record.
when i click submit button from the previous form, the record is insert into table B and delete from the table A.
is the code correct?


<? $Connect = mysql_connect("localhost","root","");
mysql_select_db("mw");
$TodayDate = strftime("%Y-%m-%d");
$TodayTime = strftime("%H:%M:%S");
$result=mysql_query("insert into LeaveApplication1 (StaffID, LeaveType, JobTitle, FromDate, ToDate, Duration, Reason, TodayDate, TodayTime, Subjects1, DateAffected1, DateReplaced1, Subjects2, DateAffected2, DateReplaced2, Subjects3, DateAffected3, DateReplaced3, Subjects4, DateAffected4, DateReplaced4, Subjects5, DateAffected5, DateReplaced5, Subjects6, DateAffected6, DateReplaced6) values ('$StaffID', '$LeaveType', '$JobTitle', '$FromDate', '$ToDate', '$Duration', '$Reason', '$TodayDate', '$TodayTime', '$Subjects1', '$DateAffected1', '$DateReplaced1', '$Subjects2', '$DateAffected2', '$DateReplaced2', '$Subjects3', '$DateAffected3', '$DateReplaced3', '$Subjects4', '$DateAffected4', '$DateReplaced4', '$Subjects5', '$DateAffected5', '$DateReplaced5', '$Subjects6', '$DateAffected6', '$DateReplaced6')");
$result=mysql_query("delete from LeaveApplication where StaffID='$StaffID' and LeaveType='$LeaveType' and JobTitle='$JobTitle' and FromDate='$FromDate' and ToDate='$FromDate' and Duration='$Duration' and Reason='$Reason' and TodayDate='$TodayDate' and TodayTime='$TodayTime' and Subjects1='$Subjects1' and DateAffected1='$DateAffected1' and DateReplaced1='$DateReplaced1' and Subjects2='$Subjects2' and DateAffected2='$DateAffected2' and DateReplaced2='$DateReplaced2' and Subjects3='$Subjects3' and DateAffected3='$DateAffected3' and DateReplaced3='$DateReplaced3' and Subjects4='$Subjects4' and DateAffected4='$DateAffected4' and DateReplaced4='$DateReplaced4' and Subjects5='$Subjects5' and DateAffected5='$DateAffected5' and DateReplaced5='$DateReplaced5' and Subjects6='$Subjects6' and DateAffected6='$DateAffected6' and DateReplaced6='$DateReplaced6'");
mysql_close();
?>
  #2  
Old 22-Jul-2003, 13:26
samtediou samtediou is offline
New Member
 
Join Date: Jul 2003
Posts: 18
samtediou is an unknown quantity at this point
Dear skyloon,

I you would like to delete the entire record, I suggest keying off of the StaffID in the delete sql. I tried it this way and it worked for me.

Let me know how it goes.

samtediou




$result=mysql_query("delete from LeaveApplication where StaffID='$StaffID' ");
mysql_close();
 
 

Recent GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A problem Between MySQL <> phpBB mirable MySQL / PHP Forum 3 10-Sep-2003 05:31
combo box select problem zuzupus MySQL / PHP Forum 2 23-Jul-2003 11:25
Integrate a mysql query into another norok MySQL / PHP Forum 2 22-Jul-2003 06:25
Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More EyotaHosts Web Hosting Advertisements & Offers 0 28-Jun-2003 13:54
mysql vs sql - what is the difference zabell MySQL / PHP Forum 2 14-Jun-2003 16:32

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:14.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.