Hi all Thanks for your replies to my question about multiple updates in one query. I think Kittiphum Worachat is right in that I have designed it wrong. I couldn't get it to do what I wanted, so I reverted to single update queries.
cheers Mark --- Summary of replies ------ from Paul Wilson -------- I'd guess that $job_number = 'AA3' or something similar. To update all 3 records inserted as above, try : update mytable set jobdate='$job_date' where job_number like 'AA_'; ------- from DL Neil ------------ However if you look at the template for the INSERT command notice that after the VALUES clause there is an ellipsis - something like: VALUES(expression [,expression]...) [,(expression, etc)...] thus you can add as many rows' worth of data as you like - each row within its own set of parentheses: insert into mytable (id,name,job_number,job_date) values ('1','Mark','AA1','2002-04-15'), ('2','Mark','AA2','2002-04-16'), ('3','Mark','AA3','2002-04-17') -------- Kittiphum Worachat --------- Your problem is misused of form transfer data please notify that by GET method the data transfer to server with name and equa sign (=) and then value each data seperate by & so id=1&name=Mark&job_number=AA1&job_date=2002-5-19 mean the data have 3 elecment id,name and job_date as your data you send 9 element but use the same name so finally it only have 3 element and the value id the last assign so you will got at last id=3&name=Mark&job_number=AA3&job_date=2002-5-25 the first and the second set has over write so when you update data you got the last data (id=3) update only how to solve this problem you shoul declare the name seperate like this id1=1&name1=Mark&job_number1=AA1&job_date1=2002-5-19 &id2=2&name2=Mark&job_number2=AA2&job_date2=2002-5-21 &id3=3&name3=Mark&job_number3=AA3&job_date3=2002-5-25 and update 3 time $sql = "UPDATE mytable set job_date='$job_date1' where job_number ='$job_number1'"; @mysql_query($sql, $connection) or die.....; $sql = "UPDATE mytable set job_date='$job_date2' where job_number ='$job_number2'"; @mysql_query($sql, $connection) or die.....; $sql = "UPDATE mytable set job_date='$job_date3' where job_number ='$job_number3'"; @mysql_query($sql, $connection) or die.....; ----------------Original question -------------- That the thing see, the form(using GET instead of POST) sends data with the new dates like this:- id=1&name=Mark&job_number=AA1&job_date=2002-5-19 &id=2&name=Mark&job_number=AA2&job_date=2002-5-21 &id=3&name=Mark&job_number=AA3&job_date=2002-5-25 and the UPDATE query like this:- > $sql = "UPDATE mytable set job_date='$job_date' where job_number > ='$job_number'"; > $result = @mysql_query($sql, $connection) or die.....; just updates the last record. Can the query be written so that it updates each of the three records? ------------------------------------------------------- --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php