SQL Query Help: Can you verify this query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siliconfinance
    Senior Member
    • Mar 2007
    • 112
    • 3.5.x

    SQL Query Help: Can you verify this query?

    Problem: Members do not close old threads before starting new ones.

    Solution I seek:
    Run an SQL query at the same the member attempts to start a new thread in that forum, closing all open threads by that user.

    SQL I managed to cobble together:
    Code:
    $forumid = forum ID;
    $username = $this->post['username'];
    $sql = "SET open = 0 FROM `thread` WHERE `forumid` = `$forumid` AND `postusername` = `$username` AND sticky = 0";
    Will it work? Thank you. Any feedback is greatly appreciated.
  • siliconfinance
    Senior Member
    • Mar 2007
    • 112
    • 3.5.x

    #2
    Or is this it?
    Code:
    $forumid = forum ID; 
    $username = $this->post['username'];
    $sql = [FONT=monospace]"[/FONT][I]UPDATE thread SET open='0' WHERE forumid='x'  [/I][FONT=monospace]AND [/FONT]`forumid` = `$forumid` AND `postusername` = `$username` AND sticky = 0";"

    Comment

    • Trevor Hannant
      vBulletin Support
      • Aug 2002
      • 24326
      • 5.7.X

      #3
      For custom coding, please post over at www.vbulletin.org
      Vote for:

      - Admin Settable Paid Subscription Reminder Timeframe (vB6)
      - Add Admin ability to auto-subscribe users to specific channel(s) (vB6)

      Comment

      • siliconfinance
        Senior Member
        • Mar 2007
        • 112
        • 3.5.x

        #4
        vBulletin.org isn't what it used to be.

        I am contacting the company that made the product. I am not looking for that company to support the product if it fails because I took some action, but I am looking for clarification on how to execute a particular MYSQL query.

        And it appears just over a month ago, one of your ranking staff members helped another user in the vB4 support forum:


        This isn't an isolated incident either. People have been seeking help directly from members and from staff on this forum:
        For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.


        It is really pathetic that vBulletin maintains a double standard. Maybe its discrimination against vB3 owners who don't want to pay the price to upgrade to vB4.

        If you want to keep your customers, stop denying them help when they try to manipulate your software to work for their community, or you will find they move to your competitors which are happy and willing to help.

        Comment

        • Wayne Luke
          vBulletin Technical Support Lead
          • Aug 2000
          • 73981

          #5
          The difference is that you're asking for more than a simple query. You need plugins and hooks to make this work which requires PHP code.

          As for your query, I'd do it by user ID instead of username.

          UPDATE thread SET open = 0 WHERE userid= X AND forumid = Y
          Last edited by Wayne Luke; Fri 9 Dec '11, 2:04pm.
          Translations provided by Google.

          Wayne Luke
          The Rabid Badger - a vBulletin Cloud demonstration site.
          vBulletin 5 API

          Comment

          • Paul M
            Former Lead Developer
            vB.Com & vB.Org
            • Sep 2004
            • 9886

            #6
            Originally posted by siliconfinance
            vBulletin.org isn't what it used to be.

            I am contacting the company that made the product. I am not looking for that company to support the product if it fails because I took some action, but I am looking for clarification on how to execute a particular MYSQL query.

            And it appears just over a month ago, one of your ranking staff members helped another user in the vB4 support forum:


            This isn't an isolated incident either. People have been seeking help directly from members and from staff on this forum:
            For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.


            It is really pathetic that vBulletin maintains a double standard. Maybe its discrimination against vB3 owners who don't want to pay the price to upgrade to vB4.

            If you want to keep your customers, stop denying them help when they try to manipulate your software to work for their community, or you will find they move to your competitors which are happy and willing to help.
            In the time it took to write that rant, (and hunt out some random example) you could have simply posted your question on vb.org as requested. You appear to have been a member for over four years, so you should already be aware that is the normal procedure.
            Baby, I was born this way

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...