![]() |
|
#1
|
|||
|
|||
select & delete mysql queriesi'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
|
|||
|
|||
|
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 GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
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