Will Posted June 20, 2007 Share Posted June 20, 2007 I decided to put this in mysql as it was more mysql than php so here it is: I currently generate all possible combination of letters and numbers going up in base 36. Generating 20,000 entries into the database per minute. I had a script: <?PHP require "mysql.php"; global $c; $nu=mysql_query("SELECT * FROM md5 WHERE done=1",$c) or die (mysql_error()); $no=mysql_num_rows($nu); mysql_query("UPDATE total SET total=$nu WHERE id=1") or die (mysql_error()); print"There are currently $nu encryption's on the database."; ?> This was working fine until I reached over 2,500,000 encryptions. Then I got this result: Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/thecrime/public_html/md5/totalcron.php on line 5 MySQL client ran out of memory I then tried: <?PHP require "mysql.php"; global $c; $nu=mysql_query("SELECT COUNT(*) FROM md5",$c) or die (mysql_error()); echo"$nu"; mysql_query("UPDATE total SET total=$nu WHERE id=1") or die (mysql_error()); ?> And I got the output: Resource id #4 plus the error of trying to write this as a number. Does anyone know how to count the rows using another method? I think the reason it is not working is something to do with my database size: Quote Link to comment Share on other sites More sharing options...
Will Posted June 20, 2007 Author Share Posted June 20, 2007 Re: Damn Database size I get: Fatal error: Maximum execution time of 30 seconds exceeded in /home/thecrime/public_html/md5/totalcron.php on line 14 Any examples of script to make this file based? Quote Link to comment Share on other sites More sharing options...
Will Posted June 20, 2007 Author Share Posted June 20, 2007 Re: Damn Database size Yeah this script calculates the total of what the other script on the other post generates. The interface is at www.thecrimelife.com/md5 Quote Link to comment Share on other sites More sharing options...
Will Posted June 20, 2007 Author Share Posted June 20, 2007 Re: Damn Database size I've sent a PM Quote Link to comment Share on other sites More sharing options...
Decepti0n Posted June 20, 2007 Share Posted June 20, 2007 Re: Damn Database size <?PHP require "mysql.php"; global $c; $nu=mysql_query("SELECT COUNT(*) FROM md5",$c) or die (mysql_error()); $x = mysql_fetch_array($nu); echo $x[0]; mysql_query("UPDATE total SET total=$nu WHERE id=1") or die (mysql_error()); ?> That's using count, dunno why you'd want 2.5mil records in files Quote Link to comment Share on other sites More sharing options...
Will Posted June 20, 2007 Author Share Posted June 20, 2007 Re: Damn Database size Thanks that count script works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.