...

View Full Version : Simple question for most. Please have a look



kevinkhan
02-22-2010, 03:13 PM
Ok basically i have a while loop but doesnt seem to work..

Every time it goes around the loop i want it to append "<b>date:</b>$d<br/><b>title:</b>$title<br><b>email:</b>$email<br/><b>id:</b>$id<p><hr />" to the $body and then mail it at the end but this doesnt work. Can anyone tell me what is wrong please?



$headers = "MIME-Version: 1.0\nContent-type: text/html; charset=iso-8859-1\nFrom: AdsInDublin <info@adsindublin.com>";
$body = "";

while ($i < $num)
{

$body. = "<b>date:</b>$d<br/><b>title:</b>$title<br><b>email:</b>$email<br/><b>id:</b>$id<p><hr />";


$i++;
}

$to = "something";
$subject = "somthing";
mail($to, $subject, $body, $headers);

angst
02-22-2010, 03:37 PM
first you should set $i = 0; to start.

also where is $num coming from?

kevinkhan
02-22-2010, 04:13 PM
first you should set $i = 0; to start.

also where is $num coming from?

That doesnt matter the loop is working in the script.. Its the mailing part that doesnt work.. of the script doesnt working because of the $body .= line when i comment out this the script works perfect

angst
02-22-2010, 04:18 PM
simple,

fix this:

$body. =

to be


$body .=

Fou-Lu
02-22-2010, 04:21 PM
Does php let us use . = for a concatenated assignment? I don't believe it does, that should probably be $body .= '...'; instead of $body. = '...'. I mean, it should still 'work', but it won't allow you to concat on the original variable.
I need to test this when I get home, now I'm curious :P


Oh, beaten to it :P
Oh well hah.

angst
02-22-2010, 04:22 PM
no it doesn't work, "Parse error: syntax error, unexpected '=" already tested.

kevinkhan
02-22-2010, 04:22 PM
ok ha ha sorry didnt spot that...

one last question for you


$upperDate = time() - (60*60*24*3); // 3 days
$lowerDate = time() - (60*60*24*4); ''; // 4 days

can you give me a number which will be in between these two variables would 1266672836
be one number?

Fou-Lu
02-22-2010, 04:55 PM
no it doesn't work, "Parse error: syntax error, unexpected '=" already tested.

Sweet, saves me the test :thumbsup:


ok ha ha sorry didnt spot that...

one last question for you


$upperDate = time() - (60*60*24*3); // 3 days
$lowerDate = time() - (60*60*24*4); ''; // 4 days

can you give me a number which will be in between these two variables would 1266672836
be one number?

What is it you're trying to do here? Are you trying to check a bound range between these two values?

MattF
02-22-2010, 04:57 PM
$upperDate = time() - (60*60*24*3); // 3 days
$lowerDate = time() - (60*60*24*4); ''; // 4 days

can you give me a number which will be in between these two variables would 1266672836
be one number?

One is supposed to answer that how? You're generating a constantly evolving figure and then asking for a static part way value? Or, are you actually asking how to generate a value for three and one half days?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum