Jump to content

MikhailGrymkabin

New Members
  • Posts

    2
  • Joined

  • Last visited

MikhailGrymkabin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. solved it myself make a new variable $result1 = mysql_query('SELECT * FROM data'); if (!$result) { die('Invalid query: ' . mysql_error()); } call it down at the while loop while($row1 = mysql_fetch_array($result1)){
  2. Hi, my code seemingly will not send the table data through email, the Table headers are sent fine, but anything after the while loop does not get sent, looking to remedy this issue.[ic]$to= 'mldecota@plymouth.edu'; <?php $to= 'mldecota@plymouth.edu'; $sub = "Hi"; $header = "Content-type: text/html"; $con = mysql_connect('localhost', 'sysop', 'Rotten210'); if (!$con){ die('could not connect' . mysql_error()) ; } $db_selected = mysql_select_db('mldecota', $con); if (!$db_selected) { die ('Borked ' . mysql_error()); } $result = mysql_query('SELECT * FROM data'); if (!$result) { die('Invalid query: ' . mysql_error()); } echo'completed succesfully'; echo "<table border='1'> <tr> <th>Date</th> <th>Time</th> <th>Machine</th> <th>Action</th> <th>User</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Date'] . "</td>"; echo "<td>" . $row['Time'] . "</td>"; echo "<td>" . $row['Machine'] . "</td>"; echo "<td>" . $row['Action'] . "</td>"; echo "<td>" . $row['USER'] . "</td>"; echo "</tr>"; } echo "</table>"; $msg = "<table border='1'> <tr> <th>Date</th> <th>Time</th> <th>Machine</th> <th>Action</th> <th>User</th> </tr>"; while($row1 = mysql_fetch_array($result)){ $msg.= "<tr>"; $msg.= "<td>" . $row1['Date'] . "</td>"; $msg.= "<td>" . $row1['Time'] . "</td>"; $msg.= "<td>" . $row1['Machine'] . "</td>"; $msg.= "<td>" . $row1['Action'] . "</td>"; $msg.= "<td>" . $row1['USER'] . "</td>"; $msg.= "</tr>"; } $msg .= "</table>"; mail($to,$sub,$msg,$header); mysql_close($con); ?> <?php phpinfo(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.