1 Replies - 72 Views - Last Post: 17 February 2015 - 07:07 PM Rate Topic: -----

#1 codespook  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 151
  • Joined: 31-October 12

sending hp formatted email

Posted 17 February 2015 - 06:49 PM

As usual, I need an extra set of eyes. I've edited this code several times, First I was getting syntax errors because of breaking in between html and php. Now I'm getting undeclared variable in line 25. This variable works fine in another script, and it is not declared before usage, same as here.
In case you need to know, this script will send email out to a specified email address at a certain time. I realize that the time is not specified. That will be scheduled in the chron job, which will be done on my provider.


<?php

$host="I dont think so";
$username="I dont think so";
$password="I dont think so";
$db_name=="I dont think so";

$conn = new mysqli($host, $username, $password, $db_name);
if ($conn->connect_error) {
  trigger_error('Database connection failed: '  . $conn->connect_error, E_USER_ERROR);
}
?>


<html>
<head></head>
<body>

<?php
//email setup
$to = "email@gmail.com";
$subject = "Subscribers List Update";
$message = " <html><head></head>
<body>"

$subscribe = "SELECT name, email, cell FROM subscribers";
$result = $conn->query($subscribe);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
?>
<table>
    <tr>
        <td><?php echo $row['name']; ?></td>
        <td><?php echo $row['email']; ?></td>
        <td><?php echo $row['cell'];?> </td>
    </tr>
</table>

<?php
      }   
} else {
    echo "0 results";
}
$conn->close();
?>

</body>
</html>
";



Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: sending hp formatted email

#2 astonecipher  Icon User is offline

  • Dishonored
  • member icon

Reputation: 899
  • View blog
  • Posts: 4,008
  • Joined: 03-December 12

Re: sending hp formatted email

Posted 17 February 2015 - 07:07 PM

Line 24 is missing a semicolon. Which is causing an error on line 25.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1