Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.