php - mySQL problems with this code? -
i having problems code , hoping can help. basically have issue whereby mysql running out of connections when script run hundreds of times in sequence. https://gist.github.com/anthonyts/b6c46d54ee8bf2d714b8 here database class: https://gist.github.com/anthonyts/89f5a831e31d970fb5e1 here error get: e_error: call member function query() on non-object stack trace: in db::single called @ /var/www/html/scripts/stalk/db.php (68) in db::single called @ /var/www/html/scripts/stalk/beanstalk_check_monitoring_logs.php (88) in {closure} called @ /var/www/html/application/libraries/stalk.php (80) in stalk::background called @ /var/www/html/scripts/stalk/ beanstalk_check_monitoring_logs.php (188) you should put db initialization: $con = mysql_connect(db_host, db_user, db_pass); mysql_select_db(db_database); $db = new db(db_host, db_user, db_pass, db_database); above your: $stalk = new stalk(array(beanstalkd_server, beanstalkd_port)); on top of script, create