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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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