Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

    Originally posted by GGandhi View Post
    isn't that the other part of the single quote right after the userid.
    i expanded to show the single quote from the post, in order to use the pUser.userid with single quotes around it.
    isn't it?

    edit: i noticed while i am writing, peter has pointed out the same idea.
    The ' single quotes are to quote strings. In MYSQL you compare strings like so: stringField='scott'

    So userid='24' is just comparing it as a string. This still works, because - as far as i know - mysql would implicitly convert userid to string to compare.
    So technically, if userid is a numeric field, you do not need the quotes.
    userid=24.

    I prefer to use arguments, both for readability, ease of writing, and protection against sql injection
    Hope this example helps
    Code:
    dim args as SQL::Arguments
    args.set("cid",session.companyID)
    
    dim no_of_employees as N=sql_lookup("::name::conn","users","companyid=:cid AND active=1","COUNT(*)",[B]args[/B])
    Scott Moniz - Computer Programmer/Analyst
    REA Inc.
    http://reainc.net
    (416)-533-3777
    [email protected]

    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
    contact us to discuss options.

    Comment


      #17
      Re: Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

      Thanks Scott but my knowledge limits me. I do get that it signifys a string, my question has been answered.
      Even though it has, now I am looking at your code example: It looks like it says the following
      dim an arg a SQL arg
      call one of the arg's "set" and give it a value of (cid and the session varible)

      Then is says to call no of employees a number with a value of the following sql lookup
      "connection path" from teh users table the company id = cid and if active = the value of 1 loop through assigning the value for each user

      am I right or am I waaaaay off?
      I sure hope I am at least close as I am putting it out there as to how dumb I am if I wrong lol...
      and so much for being self taught. I did the same thing with the guitar, turns out I am not a good guitar teacher either
      NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

      Comment


        #18
        Re: Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

        Originally posted by aburningflame View Post
        The ' single quotes are to quote strings. In MYSQL you compare strings like so: stringField='scott'
        in mysql you can use either single quote or double quotes for a string, but when you want to quote inside a quote then you need to use the other unused quote.
        so, if you want to enclose a quote inside double quote then you use the single quote and vice versa.
        "stringField='scott' "
        'stringField="scott" '
        are acceptable as far as i know.
        this is what i understood about quotes. and this is what was in that statement where the question addressed.
        i just clarified.

        and yes, arguments are better and safe.
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


          #19
          Re: Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

          Originally posted by CharlesParker View Post
          Thanks Scott but my knowledge limits me. I do get that it signifys a string, my question has been answered.
          Even though it has, now I am looking at your code example: It looks like it says the following
          dim an arg a SQL arg
          call one of the arg's "set" and give it a value of (cid and the session varible)

          Then is says to call no of employees a number with a value of the following sql lookup
          "connection path" from teh users table the company id = cid and if active = the value of 1 loop through assigning the value for each user

          am I right or am I waaaaay off?
          I sure hope I am at least close as I am putting it out there as to how dumb I am if I wrong lol...
          and so much for being self taught. I did the same thing with the guitar, turns out I am not a good guitar teacher either
          I hear ya on the self taught guitar - been playing a while myself :) - not that easy!
          Read the comments below - see if that helps

          Code:
          [B]dim showActiveOnly as L=.f.[/B] (or .t. - or this value can be set based on user input, etc)
          
          [B]dim args as SQL::Arguments[/B] 'dim a new variable named args, with the type of SQL::Arguments . SQL::Arguments is an object used to hold a [B]collection[/B] of arguments
          [B]args.set("cid",session.companyID)[/B] 'create a argument [B]named[/B] [B]cid[/B] and give it a [B]value[/B] of whatever is in session.companyID - the set method will create the variable if it does not exist, or modify an existing variable
          [B]args.set("active",showActiveOnly)[/B] 'create another argument [B]named[/B] [B]active[/B] and give it a [B]value[/B] of whatever is in the showActiveOnly variable
          
          
          'statements are read from RIGHT to LEFT
          'call the sql_lookup [B]function[/B] 
          'Param1: Our named connection, 
          'Param2: Our table, 
          'Param3: our filter (:name denotes a named argument), 
          'Param4: Retrieve the COUNT of all records (see mysql COUNT function), 
          'Param5: Pass in our arguments object so sql lookup knows where to get the value of :cid and :active
          'evaluate the sql lookup and store its RETURNED VALUE into a numeric variable named number of employees
          [B]dim no_of_employees as N=sql_lookup("::name::conn","users","companyid=:cid AND active=:active","COUNT(*)",args)[/B]
          
          'If showActiveOnly is true:This example loads the number of employees that are active at the company and will return that number e.g 55
          'If showActiveOnly is false:This example loads the number of employees that are active at the company and will return that number e.g 10
          Scott Moniz - Computer Programmer/Analyst
          REA Inc.
          http://reainc.net
          (416)-533-3777
          [email protected]

          REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
          If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
          contact us to discuss options.

          Comment


            #20
            Re: Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

            Thanks for taking the time to explain that. I know its probably cumbersome to take the time to write out what should be pretty basic stuff after awhile.
            I have actually been reading all I can (time permitting) and working at least 4-6 hours a day with alpha5 on good days with a minimum of 2 hours no matter what in the evenings.

            So far I actually have a functioning multi tenant app - and I did it all through good advice on here and perseverance, oh and coffee and beer, and some hard liqueur.

            Now I am hunting around for all the help I can get - so thanks for taking YOUR time!
            Lots of fun!
            NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

            Comment


              #21
              Re: Setting up Multiple Company Accounts Hosted by on Database in MySQL using Alpha Anywhere

              Originally posted by CharlesParker View Post
              Thanks for taking the time to explain that. I know its probably cumbersome to take the time to write out what should be pretty basic stuff after awhile.
              I have actually been reading all I can (time permitting) and working at least 4-6 hours a day with alpha5 on good days with a minimum of 2 hours no matter what in the evenings.

              So far I actually have a functioning multi tenant app - and I did it all through good advice on here and perseverance, oh and coffee and beer, and some hard liqueur.

              Now I am hunting around for all the help I can get - so thanks for taking YOUR time!
              Lots of fun!
              Heh :) no problem. I have gotten assistance here too, so I like to answer questions once in a while - sort of my way of giving back.
              We also offer 1to1 mentoring / consulting for example if you wanted to know how to go about doing a certain task etc.

              Feel free to throw me an email (and one of those beers) if you ever feel the need to!

              Thanks,
              Scott
              Scott Moniz - Computer Programmer/Analyst
              REA Inc.
              http://reainc.net
              (416)-533-3777
              [email protected]

              REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
              If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
              contact us to discuss options.

              Comment

              Working...
              X