javascript - JS Random and SQL loop -
i'm having little problem regarding randomized number , saving database. locally i'm not having problem once use host/website once 40th number stop , return err_empty_response
what have this
js:
counter=0;item_length=$('#howmanynumber').va(); function randnum(){x=math.floor(math.random()*899999) + 100000; $.post('query.php',{rnum:x},function(d){if($.trim(d)){ counter++; /**print*/ if(counter<item_length){ randnum(); } }else{ randnum(); }} php:
$rnum=$_post['rnum']; $sql="select number list number='$rnum'"; $result=mysqli_query($connect,$sql); $count=mysqli_num_rows($result); if(!$count){ $sqli="insert list(number) values('$rnum')"; mysqli_query($connect,$sqli); return true; }else{ return false; } locally can generate 1000 numbers can't figure out why stops 40 on website
host: godaddy
b'rgrds,
Comments
Post a Comment