PDA

View Full Version : Scheduled task not working


UNFAITHFUL
01-16-2009, 02:26 PM
I have a scheduled task on my site. I set it up through admincp.

When it runs I get this error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in [path]/vbbot.php on line 112
Unable to connect to mysql server.

The code on line 112 is:
$connect = mysql_connect($config['MasterServer']['servername'], $config['MasterServer']['username'] , $config['MasterServer']['password']) or die('Unable to connect to mysql server.');

I think the code on line 113 might help, The code on line 113 is:
$dbconnect = mysql_select_db($config['Database']['dbname'], $connect) or die('Unable to connect to the db');


Can someone please help me?

Lynne
01-16-2009, 02:38 PM
Why are you not just using standard vb code to do your mysql queries?

$vbulletin->db->query_read("select.....");

Dismounted
01-17-2009, 04:11 AM
Inside vBulletin Scheduled Tasks, the vBulletin engine is already initialised. Therefore, (nearly) all objects/functions/methods/variables that exist in a "normal" initialisation are available to you. One of these is the database class (as pointed out by Lynne).