473,396 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to find multiples of 1000 for comparison ?

290 100+
Hi,
I want to slow down my script so that
mySQL server can keep up.

I am counting the row numbers with $cnt
so after $cnt++; I want to add:

if ($cnt xxx ) sleep(2);

now xxx needs to be "any multiple of 1000" but I am
not sure how to code that.

As I am processing upto 30,000 records, I can not write out

if ($cnt == 1000 || $cnt == 2000 || $cnt == 3000 || $cnt == 4000 || etc etc up to 30,000)

Does anyone know how I can do this ?

Thanks
Jan 2 '10 #1
2 2808
Dormilich
8,658 Expert Mod 8TB
use the modulo operator (%).
Jan 2 '10 #2
Eeeh:
I want to slow down my script so that mySQL server can keep up.
I'm pretty sure it doesn't work that way :) PHP only goes as fast as MySQL can handle queries. If you MySQL queries are "too slow for PHP", your PHP script entirely will be slow. If your MySQL is very, very fast, PHP will be as slow as it's PHP code.

When sleep() is used, the entire script/program/application holds/sleeps/does nothing. MySQL doesn't gain by it. Use sleep only if you really want to do nothing (for example a socket timer, or an ajax chat timer, or something)
Jan 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Tom | last post by:
Hi, I need some help with stl maps. I am using a std::map that is sorted in a very special way. Therefore I am using my own sort function. That works fine. But this is only half the problem....
8
by: Rom | last post by:
I'm a bit confused as to how the STL set works with the <setname>.insert() and <setname>.find() functions Compiler used : CodeWarrior 5.0 My intial interpretation was that I needed to overload...
5
by: pankaj tiwary | last post by:
Hello experts, please consider the code fragment:- #include<stdio.h> #define TOTAL_ELEMENTS (sizeof(array)/sizeof(array)) int array = {23,34,12,17,204,99,16}; int main() {
5
by: nmtoan | last post by:
Hi, I could not find any answer to this simple question of mine. Suppose I have to write a program, the main parts of it are as follows: #include <blahblah.h> struct {
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
16
by: Michael M. | last post by:
How to find the longst element list of lists? I think, there should be an easier way then this: s1 = s2 = s3 = if len(s1) >= len(s2) and len(s1) >= len(s3): sx1=s1 ## s1 ist längster
25
by: Subra | last post by:
Hi, What is the best way to find the 1000 largest numbers from the file having hell lot of entries ? Can you please help me to find out the way ? Do I need to go for B+ trees ?? Please help,...
10
by: agendum97 | last post by:
I have three values: UInt64 a, b, c, d; I need to determine if: (a*b) <=(c*d). Naturally, just doing the multiplication and comparing would tell me the result. However, the values could...
3
by: stateemk | last post by:
Hi, I'm probably making this much harder than it needs to be, but I just can't think of how to do this. Each year, a database is created with all employees on it. I need to pull all the employees...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.