benphelps Posted August 28, 2008 Share Posted August 28, 2008 I get an error saying the host has been block due to connection errors. I have checked the MySQL query's and they are all error free, I'm not sure why this is happening. Here is the SQL part on my code. $createuser = "INSERT INTO `account` (`username`,`sha_pass_hash`,`email`,`last_ip`,`locked`,`tbc`) VALUES ('".$username."',SHA1(CONCAT(UPPER('".$username."'),':',UPPER('".$pass."'))),'".$email."','".$ip."','2','1')"; mysql_query($createuser); mysql_connect("255.255.255.255", "*****", "*****") or die(mysql_error()); mysql_select_db('realmd'); ////////////////////////////// $online = mysql_num_rows(mysql_query("SELECT online FROM account WHERE online='1';")); $accounts = mysql_num_rows(mysql_query("SELECT * FROM account;")); ////////////////////////////// mysql_select_db('characters'); $char1 = mysql_num_rows(mysql_query("SELECT guid FROM characters;")); $row1 = mysql_fetch_array(mysql_query("SELECT SUM(totaltime) AS total FROM characters;")); $played1 = $row1['total']; mysql_select_db('characters2'); $char2 = mysql_num_rows(mysql_query("SELECT guid FROM characters;")); $row2 = mysql_fetch_array(mysql_query("SELECT SUM(totaltime) AS total FROM characters;")); $played2 = $row2['total']; $characters = $char1+$char2; $played = $played1+$played2; $query = "SELECT * FROM characters WHERE online = '1' ORDER by name"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ // blah blah blah.. handle results } That's all the PHP that uses MySQL, and about once a day I have to run mysqladmin flush-hosts to allow it to continue. Is there anything I'm missing? /* edit, I connect to a remote server to handle the MySQL requests, its not on the same server as the scripts. */ Link to comment https://forums.phpfreaks.com/topic/121629-mysql-blocking-php-from-connecting/ Share on other sites More sharing options...
awpti Posted August 28, 2008 Share Posted August 28, 2008 Turn on your general query log for mySQL and find where it bombs. The log file should tell you WHY it's blocking a host. Link to comment https://forums.phpfreaks.com/topic/121629-mysql-blocking-php-from-connecting/#findComment-627446 Share on other sites More sharing options...
benphelps Posted August 28, 2008 Author Share Posted August 28, 2008 Could this be the culprit: if($f = fsockopen('12.34.56.78', 3306,$er1,$er2,0.5)) I think this is the open and unexpected close of a connection. Link to comment https://forums.phpfreaks.com/topic/121629-mysql-blocking-php-from-connecting/#findComment-627455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.