Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-07-2009, 11:00 PM   PM User | #1
selfxemployed
New to the CF scene

 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
selfxemployed is an unknown quantity at this point
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-07-2009 at 11:07 PM..
selfxemployed is offline   Reply With Quote
Old 05-08-2009, 05:19 PM   PM User | #2
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
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
Stooshie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:48 AM.


Advertisement
Log in to turn off these ads.