I did a php script that would copy stuff via a JSON call.
Im having some troubles.. first it stops after 100 +- calls. I guess it's php that times out so I guess I have to do some javascript function that calls itself and the php script.. any suggestions?
Now to the really wierd part. I do a for $i to $i loop and writes the value of I to the database. When I look at the db it sometimes contain $i that is not in the $i range and it always write $i twice.. like
Code: Select all
1100
1100
1101
1101
1102
1102
1057 //*wtf??
1103
1103
1104
1104
1023 // ??????
1105
1105
..
.
EDIT: Now I noted i could get up to 7 of the same result???
I looked at the db during runtime clicking refresh and it went like : 1101, 1134, 1102, 1103, 1167, 1104, 1126, 1105
so it was the same wierd random numbers showing up when i used the update function?
(Note this is while the script is running so no odd occurance due to php timeout)
Any idea why this is happening?
Code: Select all
for($i = 1100; $i < 1200; $i++){
if ($stmt = $mysqli->prepare("SELECT
GTIN
FROM Dabas_GTIN where id = ?")){
$stmt->bind_param('i', $i);
$stmt->execute();
$stmt->bind_result($CopyGTIN);
$stmt->store_result();
$stmt->fetch();
}
if(DabasCopy($CopyGTIN)){
if($insert_stmt = $mysqli->prepare("UPDATE Dabas_GTIN SET copied = 'YES' WHERE id = ?")) {
$insert_stmt->bind_param('i',
$i);
$insert_stmt->execute();
}
} else {die("Copy stopped at:".$i);}
/*
if($insert_stmt = $mysqli->prepare("UPDATE Copycount SET last = ? WHERE id = '1'")) {
$insert_stmt->bind_param('i',
$i);
$insert_stmt->execute();
}
*/
if($insert_stmt = $mysqli->prepare("INSERT INTO Copycount (
last) VALUES (?)")) {
$insert_stmt->bind_param('i',
$i);
$insert_stmt->execute();
}
sleep(2);
}
I do span 1200-1299
Code: Select all
up to 1229 id = last but id=1230 i suddenly get last = 1200.
then
1231-1230
1232-1201
1233-1231
1234-1202
1235-1232
1236-1203
1237-1233
ok so i guess you are starting to see a pattern here but at
1395-1233 *
1396-1293 l
1397-1205 x
1398-1264
1399-1234 *
1400-1294 l
1401-1206 x
1402-1265
1403-1235 *
so it forms some wierd pattern and after a while it adds a new loop to the pattern
like
a
a
a
a
b
a
b
a
b
a
b
c
a
b
c
a
b
c