Re: Parse Error...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remember, the print() function sends stuff to the browser. If you wish
to make the code output to the $message variable, you must use
additional assignment statements. 

I made some quick changes to the code below, try that:

<?
$server = "";
$user = "";
$pass = "";
$db = "";
$table = "";
?>

<?
$to  = "CKnott <cknott@micsystems.com>" . ", " ;
$to .= "Chase <chase@ck2000.biz>";

$subject = "Price File Access History";

$message = '
<html>
<head><title>Price File Access</title></head>

<body>
<table border="1" align="center">
<tr>
    <td>
      <div align="center"><b><i>Date / Time</i></b></div>
    </td>
    <td>
      <div align="center"><i><b>Logged IP Address</b></i></div>
    </td>
    <td>
      <div align="center"><i><b>Logged Username</b></i></div>
    </td>
</tr>
';

$link = mysql_connect("$server", "$user", "$pass");
mysql_select_db("$db", $link);

$result = mysql_query("SELECT * FROM $table ORDER BY 'view_date'
DESC",$link);
$num_rows = mysql_num_rows($result);

if($num_rows) {
//       print("<p><table border=1 align=center>");
       while($row = mysql_fetch_row($result))

       {

          $message .= "<tr>";
          $message .= "<td>$row[0]</td>";
          $message .= "<td>$row[1]</td>";
          $message .= "<td>$row[2]</td>";
          $message .= "</tr>";


       }
       $message .= "</table></p>";
     } else {
       $message .= "No Files To Show!!";

     }
$message .= "</body>
</html>
";

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "From: MIC Price File Monitor <cknott@micsystems.com>\r\n";

mail($to, $subject, $message, $headers);

?>



On Mon, 2002-12-02 at 16:30, Chase wrote:
>   There is a single quote and semicolon on the line under </html> that I
> thought would be defining the end of the assignment.
>   Should I have used double quotes instead of single?
> 
> Chase
> 
> 
> "Micah Stevens" <micah@raincross-tech.com> wrote in message
> 1038870535.23725.123.camel@tyrell">news:1038870535.23725.123.camel@tyrell...
> > There aren't any closing quotes on your $message variable or semicolon
> > to tell the parser that you're done with the assignment statement.
> >
> > -Micah
> >
> >
> >
> >
> >
> > On Mon, 2002-12-02 at 15:05, Chase wrote:
> > > When trying to execute the following script to send the contents of a
> table
> > > via "mail()" I am getting this error...
> > >
> > > Parse error: parse error, unexpected T_STRING in FILENAME.PHP on line 36
> > >
> > > The portion of this code inside the HTML tags works great for displaying
> the
> > > table on the screen, but when I include it in the larger script for
> sending
> > > a mail message, I get this error.
> > >
> > > I am sure that it is something simple that I have been too stupid to
> catch,
> > > but any help would be great!
> > >
> > > Chase
> > >
> > >
> > > Code Follows  --->
> > >
> > > <?
> > > $server = "";
> > > $user = "";
> > > $pass = "";
> > > $db = "";
> > > $table = "";
> > > ?>
> > >
> > > <?
> > > $to  = "CKnott <cknott@micsystems.com>" . ", " ;
> > > $to .= "Chase <chase@ck2000.biz>";
> > >
> > > $subject = "Price File Access History";
> > >
> > > $message = '
> > > <html>
> > > <head><title>Price File Access</title></head>
> > >
> > > <body>
> > > <table border="1" align="center">
> > > <tr>
> > >     <td>
> > >       <div align="center"><b><i>Date / Time</i></b></div>
> > >     </td>
> > >     <td>
> > >       <div align="center"><i><b>Logged IP Address</b></i></div>
> > >     </td>
> > >     <td>
> > >       <div align="center"><i><b>Logged Username</b></i></div>
> > >     </td>
> > > </tr>
> > >
> > > $link = mysql_connect("$server", "$user", "$pass");
> > > mysql_select_db("$db", $link);
> > >
> > > $result = mysql_query("SELECT * FROM $table ORDER BY 'view_date'
> > > DESC",$link);
> > > $num_rows = mysql_num_rows($result);
> > >
> > > if($num_rows) {
> > > //       print("<p><table border=1 align=center>");
> > >        while($row = mysql_fetch_row($result))
> > >
> > >        {
> > >
> > >           print("<tr>");
> > >           print("<td>$row[0]</td>");
> > >           print("<td>$row[1]</td>");
> > >           print("<td>$row[2]</td>");
> > >           print("</tr>");
> > >
> > >
> > >        }
> > >        print("</table></p>");
> > >      } else {
> > >        print("No Files To Show!!");
> > >
> > >      }
> > >
> > > </body>
> > > </html>
> > > ';
> > >
> > > $headers  = "MIME-Version: 1.0\r\n";
> > > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
> > >
> > > $headers .= "From: MIC Price File Monitor <cknott@micsystems.com>\r\n";
> > >
> > > mail($to, $subject, $message, $headers);
> > >
> > > ?>
> > >
> > --
> > Raincross Technologies
> > Development and Consulting Services
> > http://www.raincross-tech.com
> >
> >
-- 
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux