Now theres data inside.
The problem is about that,the data keeps coming and coming.
So if theres same IP with same name.
It keeps adding every time adding new lines,instead updaiting them.
THe problem is about theres new IPs coming,they will be scanned,but you cant UPDATE a data what doesn't excists.
Its hard to explain it.But are/is there any PHP functions what check if theres info about this text in MySQL if yes it updates if not it inserts??
there are many way to do this, the easiest way is using INSERT ON DUPLICATE KEY UPDATE or REPLACE INTO (pretty simple, one query), other way would be creating trigger event (if you need to do some checks which are not related to primary/unique keys).
But remember, for first method you need have MySQL 5.0+ so be sure before you implement this.
Well thanks for reminding the MySQL functions.
Istead triggers I ill use debugging statements.
So basicly if user requests a page,the following line will be excuted.
Attenting to SL code
Theres this one.
Didn't notice this one before.
But yeah,seems to work.
there are many way how you can do it, from simple ones to complex ones, if you need to save as much of processing/time per query as you can, you would go for DB only way to do it (since its possible). But you have enough resources and dont really care that much for any bit of a performance boost, simple ones can be better if you are not that much into advanced query building.
btw, in assumption that SESIDX and PLIDX are unique keys, you could try this:
Heh:D
Dun worry about the performence.
The trackercore has impressive framework.
Proofed.I got 1700 servers scanned and the kept scanned every 30second and this way for 6 days and only it used only 8% of memory =)
tbh..it makes forcescan to all servers in 10 seconds.
Then the system gets 30seconds to sleep and again repeats all this.
If (select blabla from table where uniqueID = ?)
update;
else
insert;
what also helps is to set the keys to be unique in your DB, but then you'll just get an error if it tries to insert it, it wont update i think.
What comment #1 says about MySQL options i dont know much about but it seems interesting if its possible to catch such exceptions with trigger events :)
well, I admit your method would by far the simplest one but I guess this is perfect example of what should be treated on DB side exclusively (checking if row exists and then decide whether do an update or insert would take much more processing and time compared to single statement, especialy for big tables).
But remember, for first method you need have MySQL 5.0+ so be sure before you implement this.
Istead triggers I ill use debugging statements.
So basicly if user requests a page,the following line will be excuted.
Attenting to SL code
Theres this one.
Didn't notice this one before.
But yeah,seems to work.
btw, in assumption that SESIDX and PLIDX are unique keys, you could try this:
hope I didnt do any typo :)
Dun worry about the performence.
The trackercore has impressive framework.
Proofed.I got 1700 servers scanned and the kept scanned every 30second and this way for 6 days and only it used only 8% of memory =)
tbh..it makes forcescan to all servers in 10 seconds.
Then the system gets 30seconds to sleep and again repeats all this.
If (select blabla from table where uniqueID = ?)
update;
else
insert;
what also helps is to set the keys to be unique in your DB, but then you'll just get an error if it tries to insert it, it wont update i think.
What comment #1 says about MySQL options i dont know much about but it seems interesting if its possible to catch such exceptions with trigger events :)