tgavin Posted July 24, 2006 Share Posted July 24, 2006 is it possible to combine the following 8 queries into 1 query?[code] $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($theme)."' WHERE pref_name = 'theme'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($tooltips)."' WHERE pref_name = 'tooltips'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($icnsize)."' WHERE pref_name = 'icons'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($updates)."' WHERE pref_name = 'updates'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($confirm_msgs)."' WHERE pref_name = 'confirm_msgs'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($new_sub_notify)."' WHERE pref_name = 'new_sub_notify'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($sub_activation)."' WHERE pref_name = 'sub_activation'"); $sql = mysql_query("UPDATE prefs SET pref_value = '".strip($show_pagination)."' WHERE pref_name = 'show_pagination'");[/code]Thanks! Quote Link to comment Share on other sites More sharing options...
fenway Posted July 24, 2006 Share Posted July 24, 2006 Sure... you can use the oft-forgotten CASE statment; it would be a really long and ugly query, but it will get the job done. Check the refman for the syntax, I haven't used it in years. Quote Link to comment Share on other sites More sharing options...
tgavin Posted July 24, 2006 Author Share Posted July 24, 2006 [quote author=fenway link=topic=101692.msg402649#msg402649 date=1153757428]Sure... you can use the oft-forgotten CASE statment; it would be a really long and ugly query, but it will get the job done. Check the refman for the syntax, I haven't used it in years.[/quote]Would I be better off just using the 8 queries I already have instead?Thanks! Quote Link to comment Share on other sites More sharing options...
fenway Posted July 24, 2006 Share Posted July 24, 2006 Well, if you're going to end up doing all 8 anyway, then probably. Quote Link to comment 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.