Jump to content

mailto() funtion with dynamic data


pambo

Recommended Posts

Hi,

Im quite new with php, and i am having a lot of trouble trying to use the code for a website. I was wondering whether you could possibly help me with the following problem:

 

I populated a dynamic table with data from a MySQL database (using a dreamweaver recordset), and i am now trying to mail the data from that table to a certain email address. The data in the table isnt always the same- but i need to mail all the records at any one time... can anyone help me?

thanks a lot!

 

the code that im using is below:

 


<?php require_once('Connections/MySQL_database.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_MySQL_database, $MySQL_database);
$query_getdata = "SELECT referencia, priceunit, quantity, colour, pricefinal FROM populate ORDER BY referencia ASC";
$getdata = mysql_query($query_getdata, $MySQL_database) or die(mysql_error());
$row_getdata = mysql_fetch_assoc($getdata);
$totalRows_getdata = mysql_num_rows($getdata);

?>
<table border="1">
  <tr>
    <td><div align="center"><strong>referencia</strong></div></td>
    <td><div align="center"><strong>priceunit</strong></div></td>
    <td><div align="center"><strong>quantity</strong></div></td>
    <td><div align="center"><strong>colour</strong></div></td>
    <td><div align="center"><strong>pricefinal</strong></div></td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_getdata['referencia']; ?></td>
      <td><?php echo $row_getdata['priceunit']; ?></td>
      <td><?php echo $row_getdata['quantity']; ?></td>
      <td><?php echo $row_getdata['colour']; ?></td>
      <td><?php echo $row_getdata['pricefinal']; ?></td>
    </tr>
    
    
   <?php } while ($row_getdata = mysql_fetch_assoc($getdata));   
?>
</table>

<?php

mysql_free_result($getdata);
?>

Link to comment
https://forums.phpfreaks.com/topic/80807-mailto-funtion-with-dynamic-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.