DeepakJ Posted July 30, 2007 Share Posted July 30, 2007 Ok so I want to create an update in this table productid invoicenum xxx yyy xxy yyz But I want to change the productid from ""(initially entered before in teh script) to the actual key with this table. There can be multiple invoice num in this table. How can I make a SQL instruction that will only update the FIRST "" string available. UPDATE productid SET productid='$productid' WHERE invoicenum=$invoicenum changes all the null strings at the particular invoice num. Help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/62539-how-should-i-structure-code/ Share on other sites More sharing options...
severndigital Posted July 30, 2007 Share Posted July 30, 2007 quick answer (not sure if it is the best though) add a time stamp to the entry and update based off that. i can elaborate more if you want to go that way. chris Link to comment https://forums.phpfreaks.com/topic/62539-how-should-i-structure-code/#findComment-311474 Share on other sites More sharing options...
fenway Posted July 31, 2007 Share Posted July 31, 2007 I don't know why you're trying to accomplish this task, so it's hard to suggest alternatives. Link to comment https://forums.phpfreaks.com/topic/62539-how-should-i-structure-code/#findComment-312086 Share on other sites More sharing options...
Iceman512 Posted August 1, 2007 Share Posted August 1, 2007 Hi DeepakJ, I hope I'm understanding you rightly... how about something like this: <?php UPDATE productid SET productid='$productid' WHERE invoicenum = '' LIMIT 1 ?> or <?php UPDATE productid SET productid='$productid' WHERE invoicenum != '' LIMIT 1 ?> Does that make any sense or help at all? Iceman Link to comment https://forums.phpfreaks.com/topic/62539-how-should-i-structure-code/#findComment-312831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.