sam06 Posted April 15, 2009 Share Posted April 15, 2009 Any ideas guys? My code: <?php mysql_connect*********************** $query = "SELECT * FROM usertable"; $result = mysql_query($query) or die(mysql_error()); $name = "Free Sweet Rewards"; $email = "samuelhale@btinternet.com"; while($row = mysql_fetch_array( $result )) { $message = "Hi there $row['username'],\nFree Sweet Rewards has recently added a load of new offers avaliable.\nThere are also a great deal of daily clicks avaliable for you to do. These clicks can mean you can order a package in just a week!\nPlease let us know what you think of the new offers!\nKind Regards,\nSam Hale - Chief Executive Officer, Ramico Media."; $to = "samuelhale@btinternet.com"; $subject = "Message from $name"; $body = "$message"; $headers = "From: $email\r\n" . "X-Mailer: php"; } ?> It's not looping yet, I just wanted to test it with my email address before sending it to the database. It's coming up with error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in email1.php on line 11 I've tried it with spaces after the \n, and without. No idea. Many Thanks, Sam Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 15, 2009 Share Posted April 15, 2009 If you use array values in "" strings, you have to put them in curly brackets {} $message = "Hi there {$row['username']},\nFree Sweet..."; Quote Link to comment Share on other sites More sharing options...
sam06 Posted April 16, 2009 Author Share Posted April 16, 2009 Brilliant, thanks for your time. Quote Link to comment Share on other sites More sharing options...
bloodgoat Posted April 16, 2009 Share Posted April 16, 2009 If you use array values in "" strings, you have to put them in curly brackets {} $message = "Hi there {$row['username']},\nFree Sweet..."; Good to know for the future. Before, I just used to close and reopen the quotation. Ie/ $message = "Hi there ".$row['username'].",\nFree Sweet..."; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.