Re: Help with an error...
| From: | Philip Thompson | Date: | Fri, 25 Jul 2008 20:59:21 +0000 |
| Subject: | Re: Help with an error... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277344@lists.php.net to get a copy of this message | ||
On Jul 24, 2008, at 12:40 PM, Micah Gersten wrote:
You cannot have commands in the middle of a string.Technically you can. <?php $str = "Hi, my name is " . $this->getName(); // or $str = "Hi, my name is $this->getName()"; echo $str; ?> ~Philip
Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com payne@magi.magidesign.com wrote:Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? --------------------------------------------- <?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = "Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;"; $result = mysql_query($query)$mailsend = mail("terrorpup@gmail.com","The IP's that Attacked$hostname", "The following are ip's that have try to attack your system.\r\n\r\if ($result) { //if that ran ok, display the record echo "<table width=\'150\'><tr><td> Country </td><td> # ofAttacks </td></tr>";//fetch and print the recordswhile ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo "<tr><td align=\'left\'>$row[0]</td><td><divalign=\'right\'>$row[1]</div></td></tr>";}echo '</table>';mysql_free_result ($result); //free up the resources} else { //if did not run okecho '<p>This could not be display due to a system error.We apologize fore any incovenience.</p><p>'. mysql_error() . '</p>';}","From:fyre@foobar.co.uk\r\nReply To:fyre@foobar.co.uk"); print("$mailsend"); ?>