For reason I won't bore you with, I need to update an archive database periodically with typically blocks of 100-300 records.
Each record has 6 visible fields in the database.
Frequently 4 of the 6 fields have the same information in them for the whole block of data.
For a good reason I do this by creating the required number of empty records in the database for the required block of data then manually editing each record.
My intension was to complete the first record of the block, and then create a program that would read that record and then duplicate the data for those 4 fields in all the records in the block.
I would then only have to manually edit a couple of fields for each record.
I have programmed the first part and obtain the data to be duplicated in 4 session variables but for some reason none of my attempts to update those the block of records from unique_id =$first to $last (in the primary ID field) appears to work. If you could suggest where I am going wrong as simply as possible I would be grateful. Many thanks for your time.
$x=$first;
whilst ($x <= $last) {
$query = ("UPDATE $tn SET
source = $_SESSION['source'],
type = '$_SESSION['type'],
size = '$_SESSION['size'],
comments = $_SESSION['comments'] WHERE unique_id = '$x' ");
$result = mysql_query($query);
$x=$x+1;
}