Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delayed AutoResponder Errors

    [07-May-2009 16:20:01] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/sandip89/public_html/email/autoresponder.php on line 44

    [07-May-2009 16:21:14] PHP Parse error: syntax error, unexpected T_IF in /home/sandip89/public_html/email/autoresponder.php on line 45

    Here's lines 40-50

    PHP Code:
    function PutInTheQueue($email)
    {
        global 
    $database;
        if (
    mysql_fetch_row(mysql_query("select * from {$database['table']} where `account`=".mslash($email['account'])." AND message_id=".mslash($email['message_id']))))
            return 
    true;//already in queue
        
    $email['duetime'] = date("Y-m-d H:i:s",$email['duetime']);
        return 
    mysql_query(InsertSQL($database['table'],$email));
    }
    //------------------------------------------------------------------------------
    function mslash($s
    Last edited by selfxemployed; 05-08-2009 at 12:07 AM.

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    380
    Thanks
    9
    Thanked 39 Times in 39 Posts
    I haven't seen the curly braces in:
    [code]
    ... from {$database['table']} where ...
    [/code/
    used that way in php before. I would tend to do:
    Code:
    ... from ".$database['table']." where ...
    Also the:
    Code:
     ... where `account`= ...
    is using the weird MS single apostrophes. I would miss them out and do:
    Code:
     ... where account= ...
    Other than that I can't see anything else particularly wrong.

    Altered code:
    Code:
    function PutInTheQueue($email)
    {
    	global $database;
    	if(
    		mysql_fetch_row(
    			mysql_query(
    				"select
    					*
    				from
    					".$database['table']."
    				where
    					account'=".mslash($email['account'])."
    				AND
    					message_id=".mslash($email['message_id'])
    			)
    		)
    	)
    	{
    		return true;//already in queue
    	}
    	$email['duetime'] = date("Y-m-d H:i:s",$email['duetime']);
    	return mysql_query(InsertSQL($database['table'],$email));
    }
    //------------------------------------------------------------------------------
    function mslash($s)
    I can't test it as I don't have access to your DB. let me know how it goes.
    Regards, Stooshie
    O


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •