Jump to content

combine queries


tgavin

Recommended Posts

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!
Link to comment
https://forums.phpfreaks.com/topic/15504-combine-queries/
Share on other sites

[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!
Link to comment
https://forums.phpfreaks.com/topic/15504-combine-queries/#findComment-62990
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.