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. Quote 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 Quote 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. Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.