Jump to content

Recommended Posts

ok so i need help in sorting out the easiest way to do this

 

i have 4 diffrent servers from where i can pull data what i want to do is

 

In the first visit it pulls data from server 1 then from the second visit it pulls data from server 2 then from server 3 and then from server 4 and 4 is used again back to 1

 

right now i am doing this using php random but it wont equally distribute it this way

 

can u tell me how to do this the easiest way ?

Link to comment
https://forums.phpfreaks.com/topic/266533-need-help-with-the-easiest-logic/
Share on other sites

The only way to do what you are asking would be to save a value each time you execute the script. But, you really have not provided enough information to really provide a full answer. Are the "visits" by the same user? Is the iteration through server supposed to be over the course of a session (if so use a session variable) or across sessions (use a cookie). Or are the "bisits" supposed to be based upon all users as they access the page(s)? If so, you would need to store a value server-side.

its more like i am running a mysql loop of sending smses to diffrent users and i have 4 diffrent gateways whose apis i use to send these smses so what i want to do is to the first user it sends through gateway one to the second it send through gateway 2 and this keeps going on and on

That's 2 queries per pageload, which is not a whole lot. Assuming you're sending the message to 100 numbers per pageload, as your post suggests.

If you're talking about 100 users sending one message each, then that's still just 2 queries per pageload. Nothing to worry about.

 

If you have the queries inside a loop, then you're most likely doing something wrong. In this case, I'm sure of it.

All you need to do, is to get the starting value from the DB before the loop, and save the new one after the loop.

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.