Yes I would prefer to do this... problem is that the final table will be populated from a monthly csv file supplied from an external source.
this file could have several hundred occurences of each value of A_Number and other fields so the only way to have it as unique is to use several of the fields in the recordset as the 'key'... I tried both suggestions - thanks, but still no luck. Any more ideas? I don't really want to have to go and rewrite the update to include a unique id for each record! Thanks guys for your help. Enda -- -----Original Message----- From: Jonathan Wilkes [mailto:[EMAIL PROTECTED] Sent: 19 December 2003 16:39 To: Enda; Php-General Subject: RE: [PHP] mysql update query Hi Enda, Does your table have an index per record ? If so, your WHERE clause could just use the index and thus be far simpler, if "A_Number" is an indexed field, then UPDATE cdr200311 SET Price=0.225 WHERE A_Number = 61210146 Alternatively, try removing the () around the WHERE Darka www.xfcpro.com -----Original Message----- From: Enda [mailto:[EMAIL PROTECTED] Sent: 19 December 2003 16:33 To: Php-General Subject: [PHP] mysql update query Hi guys Bit of a problem I'm having here with an update query on a PHP/MySQL site: This is the db query I execute: $result6=mysql_query("UPDATE $WorkTable SET Price=$CallCost WHERE (A_Number = $A_Number AND StartDateTime = $D_Full AND Duration=$Duration AND SMSDestinationName = '$SMSDestinationName')"); which returns the following SQL query: UPDATE cdr200311 SET Price=0.225 WHERE (A_Number = 61210146 AND StartDateTime = 2003110216502400 AND Duration=15.0167 AND SMSDestinationName = '1010') The query executes successfully, but nothing happens to the database... all connections etc are in place. Am I right to have the brackets around the WHERE conditions? I have also tried this query in phpMyAdmin but no result... and yes, the record does exist.. Help! Thanks Enda -- -- Enda Nagle NightSol e: [EMAIL PROTECTED] w: www.nightsol.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php